mirror of
https://gitea.invidious.io/iv-org/shard-ameba.git
synced 2024-08-15 00:53:29 +00:00
Extend StaticComparison
w/ support of ===
operator
This commit is contained in:
parent
849be52618
commit
ea42911c3c
2 changed files with 17 additions and 9 deletions
|
@ -6,13 +6,21 @@ module Ameba::Rule::Lint
|
|||
describe StaticComparison do
|
||||
it "passes for valid cases" do
|
||||
expect_no_issues subject, <<-CRYSTAL
|
||||
/foo/ === "foo"
|
||||
"foo" == foo
|
||||
"foo" != foo
|
||||
foo == "foo"
|
||||
foo != "foo"
|
||||
CRYSTAL
|
||||
end
|
||||
|
||||
it "reports if there is a static comparison evaluating to true" do
|
||||
it "reports if there is a static comparison evaluating to the same" do
|
||||
expect_issue subject, <<-CRYSTAL
|
||||
"foo" === "foo"
|
||||
# ^^^^^^^^^^^^^ error: Comparison always evaluates to the same
|
||||
CRYSTAL
|
||||
end
|
||||
|
||||
it "reports if there is a static comparison evaluating to true (2)" do
|
||||
expect_issue subject, <<-CRYSTAL
|
||||
"foo" == "foo"
|
||||
# ^^^^^^^^^^^^ error: Comparison always evaluates to true
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue