mirror of
https://gitea.invidious.io/iv-org/shard-ameba.git
synced 2024-08-15 00:53:29 +00:00
Prevent false positiveness cause by macro literals
https://github.com/crystal-lang/crystal/pull/6055#issuecomment-386376227
This commit is contained in:
parent
6579c8f573
commit
415432713a
5 changed files with 47 additions and 25 deletions
|
@ -820,6 +820,37 @@ module Ameba::Rule
|
|||
)
|
||||
subject.catch(s).should be_valid
|
||||
end
|
||||
|
||||
it "doesn't report if assignment is referenced in macro def" do
|
||||
s = Source.new %(
|
||||
macro macro_call
|
||||
puts x
|
||||
end
|
||||
|
||||
def foo
|
||||
x = 1
|
||||
macro_call
|
||||
end
|
||||
)
|
||||
subject.catch(s).should be_valid
|
||||
end
|
||||
|
||||
it "reports if assignment is referenced in macro def in a different scope" do
|
||||
s = Source.new %(
|
||||
class Foo
|
||||
def foo
|
||||
x = 1
|
||||
end
|
||||
end
|
||||
|
||||
class Bar
|
||||
macro macro_call
|
||||
puts x
|
||||
end
|
||||
end
|
||||
)
|
||||
subject.catch(s).should_not be_valid
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue