Rework tests

This commit is contained in:
Vitalii Elenhaupt 2023-02-07 22:20:10 +02:00
parent d20cc212b9
commit 61a45d4321
No known key found for this signature in database
GPG key ID: CD0BF17825928BC0

View file

@ -476,13 +476,18 @@ module Ameba::Rule::Lint
issue.message.should eq "Useless assignment to variable `foo`" issue.message.should eq "Useless assignment to variable `foo`"
end end
it "doesn't report if top level variable defined inside class is referenced" do it "doesn't report if top level variable defined inside module and referenced" do
s = Source.new %( s = Source.new %(
class A module A
foo : String? = "foo" foo : String? = "foo"
bar do
foo = "bar"
end
p foo
end end
puts foo
) )
subject.catch(s).should be_valid subject.catch(s).should be_valid
end end
@ -492,12 +497,10 @@ module Ameba::Rule::Lint
class A class A
foo : String? = "foo" foo : String? = "foo"
bar do def method
foo = "bar" foo = "bar"
end end
end end
puts foo
) )
subject.catch(s).should be_valid subject.catch(s).should be_valid
end end