mirror of
https://gitea.invidious.io/iv-org/shard-ameba.git
synced 2024-08-15 00:53:29 +00:00
Rework tests
This commit is contained in:
parent
d20cc212b9
commit
61a45d4321
1 changed files with 9 additions and 6 deletions
|
@ -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
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue