mirror of
https://gitea.invidious.io/iv-org/shard-ameba.git
synced 2024-08-15 00:53:29 +00:00
Unused argument rule (#52)
* Unused argument rule * IgnoreDefs, IgnoreBlocks, IgnoreProcs parameters * Implicit reference by super keyworkd * Handle macro arguments
This commit is contained in:
parent
cc71511080
commit
c2aa526e21
8 changed files with 467 additions and 22 deletions
40
spec/ameba/ast/variabling/argument_spec.cr
Normal file
40
spec/ameba/ast/variabling/argument_spec.cr
Normal file
|
@ -0,0 +1,40 @@
|
|||
require "../../../spec_helper"
|
||||
|
||||
module Ameba::AST
|
||||
describe Argument do
|
||||
arg = Crystal::Arg.new "a"
|
||||
scope = Scope.new as_node "foo = 1"
|
||||
variable = Variable.new(Crystal::Var.new("foo"), scope)
|
||||
|
||||
describe "#initialize" do
|
||||
it "creates a new argument" do
|
||||
argument = Argument.new(arg, variable)
|
||||
argument.node.should_not be_nil
|
||||
end
|
||||
end
|
||||
|
||||
describe "delegation" do
|
||||
it "delegates location to node" do
|
||||
argument = Argument.new(arg, variable)
|
||||
argument.location.should eq arg.location
|
||||
end
|
||||
|
||||
it "delegates to_s to node" do
|
||||
argument = Argument.new(arg, variable)
|
||||
argument.to_s.should eq arg.to_s
|
||||
end
|
||||
end
|
||||
|
||||
describe "#ignored?" do
|
||||
it "is true if arg starts with _" do
|
||||
argument = Argument.new(Crystal::Arg.new("_a"), variable)
|
||||
argument.ignored?.should be_true
|
||||
end
|
||||
|
||||
it "is false otherwise" do
|
||||
argument = Argument.new(arg, variable)
|
||||
argument.ignored?.should be_false
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue