This commit is contained in:
Vitalii Elenhaupt 2018-05-08 22:18:15 +03:00
parent c2aa526e21
commit eab5499f8e
No known key found for this signature in database
GPG key ID: 7558EF3A4056C706
5 changed files with 46 additions and 12 deletions

View file

@ -137,6 +137,17 @@ module Ameba::Rule
subject.catch(s).should be_valid
end
it "doesn't report if arg if referenced in case" do
s = Source.new %(
def foo(a)
case a
when /foo/
end
end
)
subject.catch(s).should be_valid
end
context "super" do
it "reports if variable is not referenced implicitly by super" do
s = Source.new %(

View file

@ -582,6 +582,18 @@ module Ameba::Rule
s.errors.first.location.to_s.should eq ":5:17"
s.errors.last.location.to_s.should eq ":7:17"
end
it "doesn't report if assignment is referenced in cond" do
s = Source.new %(
def method
a = 2
case a
when /foo/
end
end
)
subject.catch(s).should be_valid
end
end
context "binary operator" do