Fix regression in AnyInsteadOfEmpty rule

This commit is contained in:
Sijawusz Pur Rahnama 2022-04-22 00:55:13 +02:00
parent 73bd1ba5a3
commit fbd72a5171
2 changed files with 4 additions and 4 deletions

View file

@ -16,7 +16,7 @@ module Ameba::Rule::Performance
it "reports if there is any? call without a block nor argument" do
source = expect_issue subject, <<-CRYSTAL
[1, 2, 3].any?
# ^^^^^^^^^^^^ error: Use `!{...}.empty?` instead of `{...}.any?`
# ^^^^ error: Use `!{...}.empty?` instead of `{...}.any?`
CRYSTAL
expect_correction source, <<-CRYSTAL
@ -34,7 +34,7 @@ module Ameba::Rule::Performance
it "reports in macro scope" do
source = expect_issue subject, <<-CRYSTAL
{{ [1, 2, 3].any? }}
# ^^^^^^^^^^^^^^ error: Use `!{...}.empty?` instead of `{...}.any?`
# ^^^^ error: Use `!{...}.empty?` instead of `{...}.any?`
CRYSTAL
expect_correction source, <<-CRYSTAL
@ -51,7 +51,7 @@ module Ameba::Rule::Performance
issue = source.issues.first
issue.rule.should_not be_nil
issue.location.to_s.should eq "source.cr:1:1"
issue.location.to_s.should eq "source.cr:1:11"
issue.end_location.to_s.should eq "source.cr:1:14"
issue.message.should eq "Use `!{...}.empty?` instead of `{...}.any?`"
end