mirror of
https://gitea.invidious.io/iv-org/shard-ameba.git
synced 2024-08-15 00:53:29 +00:00
Add test spec covering accessor macros
This commit is contained in:
parent
4567293add
commit
aeffa6ad00
1 changed files with 17 additions and 0 deletions
|
@ -393,6 +393,23 @@ module Ameba::Rule::Lint
|
||||||
CRYSTAL
|
CRYSTAL
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it "doesn't report if this is an accessor declaration" do
|
||||||
|
accessor_macros = %w[setter class_setter]
|
||||||
|
%w[getter class_getter property class_property].each do |name|
|
||||||
|
accessor_macros << name
|
||||||
|
accessor_macros << "#{name}?"
|
||||||
|
accessor_macros << "#{name}!"
|
||||||
|
end
|
||||||
|
accessor_macros.each do |accessor|
|
||||||
|
expect_no_issues subject, <<-CRYSTAL
|
||||||
|
class Foo
|
||||||
|
#{accessor} foo : String?
|
||||||
|
#{accessor} bar = "bar"
|
||||||
|
end
|
||||||
|
CRYSTAL
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
it "does not report if assignment is referenced after the record declaration" do
|
it "does not report if assignment is referenced after the record declaration" do
|
||||||
expect_no_issues subject, <<-CRYSTAL
|
expect_no_issues subject, <<-CRYSTAL
|
||||||
foo = 2
|
foo = 2
|
||||||
|
|
Loading…
Reference in a new issue