mirror of
https://gitea.invidious.io/iv-org/shard-ameba.git
synced 2024-08-15 00:53:29 +00:00
Fix the edge case re: free var comparison
This commit is contained in:
parent
35ff16206c
commit
5491d31b5f
2 changed files with 24 additions and 0 deletions
|
@ -41,6 +41,13 @@ module Ameba::Rule::Lint
|
|||
CRYSTAL
|
||||
end
|
||||
|
||||
pending "reports if there is a static path comparison evaluating to false" do
|
||||
expect_issue subject, <<-CRYSTAL
|
||||
String == Nil
|
||||
# ^^^^^^^^^^^ error: Comparison always evaluates to false
|
||||
CRYSTAL
|
||||
end
|
||||
|
||||
context "macro" do
|
||||
it "reports in macro scope" do
|
||||
expect_issue subject, <<-CRYSTAL
|
||||
|
@ -48,6 +55,12 @@ module Ameba::Rule::Lint
|
|||
# ^^^^^^^^^^^^^^ error: Comparison always evaluates to true
|
||||
CRYSTAL
|
||||
end
|
||||
|
||||
it "passes for free variables comparisons in macro scope" do
|
||||
expect_no_issues subject, <<-CRYSTAL
|
||||
{{ T == Nil }}
|
||||
CRYSTAL
|
||||
end
|
||||
end
|
||||
|
||||
it "reports rule, pos and message" do
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue