mirror of
https://gitea.invidious.io/iv-org/shard-ameba.git
synced 2024-08-15 00:53:29 +00:00
Fix few issues reported by the newly added rule
This commit is contained in:
parent
67356f246b
commit
eb64fde437
4 changed files with 12 additions and 10 deletions
|
@ -135,14 +135,16 @@ module Ameba::AST
|
|||
scope = Scope.new as_node("foo = 1")
|
||||
scope.add_variable Crystal::Var.new "foo"
|
||||
scope.assign_variable("foo", Crystal::Var.new "foo")
|
||||
scope.find_variable("foo").not_nil!.assignments.size.should eq 1
|
||||
var = scope.find_variable("foo").should_not be_nil
|
||||
var.assignments.size.should eq 1
|
||||
end
|
||||
|
||||
it "does not create the assignment if variable is wrong" do
|
||||
scope = Scope.new as_node("foo = 1")
|
||||
scope.add_variable Crystal::Var.new "foo"
|
||||
scope.assign_variable("bar", Crystal::Var.new "bar")
|
||||
scope.find_variable("foo").not_nil!.assignments.size.should eq 0
|
||||
var = scope.find_variable("foo").should_not be_nil
|
||||
var.assignments.size.should eq 0
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -86,8 +86,8 @@ module Ameba
|
|||
s1.add_issue DummyRule.new, {2, 2}, "message1"
|
||||
s2.add_issue DummyRule.new, {2, 2}, "message2"
|
||||
|
||||
file = formatter.finished([s1, s2])
|
||||
content = File.read(file.not_nil!.path)
|
||||
file = formatter.finished([s1, s2]).should_not be_nil
|
||||
content = File.read(file.path)
|
||||
content.should contain <<-CONTENT
|
||||
# Problems found: 3
|
||||
# Run `ameba --only Ameba/DummyRule` for details
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue