mirror of
https://gitea.invidious.io/iv-org/shard-ameba.git
synced 2024-08-15 00:53:29 +00:00
Refactor Lint/StaticComparison
to LiteralsComparison
This commit is contained in:
parent
23ca87ff0e
commit
6bf8db81e3
2 changed files with 35 additions and 12 deletions
|
@ -1,9 +1,9 @@
|
|||
require "../../../spec_helper"
|
||||
|
||||
module Ameba::Rule::Lint
|
||||
subject = StaticComparison.new
|
||||
subject = LiteralsComparison.new
|
||||
|
||||
describe StaticComparison do
|
||||
describe LiteralsComparison do
|
||||
it "passes for valid cases" do
|
||||
expect_no_issues subject, <<-CRYSTAL
|
||||
"foo" == foo
|
||||
|
@ -13,6 +13,13 @@ module Ameba::Rule::Lint
|
|||
CRYSTAL
|
||||
end
|
||||
|
||||
it "reports if there is a regex comparison possibly evaluating to the same" do
|
||||
expect_issue subject, <<-CRYSTAL
|
||||
/foo/ === "foo"
|
||||
# ^^^^^^^^^^^^^ error: Comparison most likely evaluates to the same
|
||||
CRYSTAL
|
||||
end
|
||||
|
||||
it "reports if there is a static comparison evaluating to the same" do
|
||||
expect_issue subject, <<-CRYSTAL
|
||||
"foo" === "foo"
|
Loading…
Add table
Add a link
Reference in a new issue