mirror of
https://gitea.invidious.io/iv-org/shard-ameba.git
synced 2024-08-15 00:53:29 +00:00
Merge remote-tracking branch 'origin/master' into master-into-develop
This commit is contained in:
commit
99da6b6916
7 changed files with 193 additions and 18 deletions
|
@ -944,6 +944,108 @@ module Ameba::Rule::Lint
|
|||
)
|
||||
subject.catch(s).should be_valid
|
||||
end
|
||||
|
||||
it "doesn't report if assignment is referenced in a macro expression as string" do
|
||||
s = Source.new %(
|
||||
foo = 1
|
||||
puts {{ "foo".id }}
|
||||
)
|
||||
subject.catch(s).should be_valid
|
||||
end
|
||||
|
||||
it "doesn't report if assignement is referenced in for macro in exp" do
|
||||
s = Source.new %(
|
||||
foo = 22
|
||||
|
||||
{% for x in %w(foo) %}
|
||||
add({{x.id}})
|
||||
{% end %}
|
||||
)
|
||||
subject.catch(s).should be_valid
|
||||
end
|
||||
|
||||
it "doesn't report if assignement is referenced in for macro in body" do
|
||||
s = Source.new %(
|
||||
foo = 22
|
||||
|
||||
{% for x in %w(bar) %}
|
||||
puts {{ "foo".id }}
|
||||
{% end %}
|
||||
)
|
||||
subject.catch(s).should be_valid
|
||||
end
|
||||
|
||||
it "doesn't report if assignement is referenced in if macro in cond" do
|
||||
s = Source.new %(
|
||||
foo = 22
|
||||
{% if "foo".id %}
|
||||
{% end %}
|
||||
)
|
||||
subject.catch(s).should be_valid
|
||||
end
|
||||
|
||||
it "doesn't report if assignement is referenced in if macro in then" do
|
||||
s = Source.new %(
|
||||
foo = 22
|
||||
{% if true %}
|
||||
puts {{ "foo".id }}
|
||||
{% end %}
|
||||
)
|
||||
subject.catch(s).should be_valid
|
||||
end
|
||||
|
||||
it "doesn't report if assignement is referenced in if macro in else" do
|
||||
s = Source.new %(
|
||||
foo = 22
|
||||
{% if true %}
|
||||
{% else %}
|
||||
puts {{ "foo".id }}
|
||||
{% end %}
|
||||
)
|
||||
subject.catch(s).should be_valid
|
||||
end
|
||||
end
|
||||
|
||||
it "does not report if variable is referenced and there is a deep level scope" do
|
||||
s = Source.new %(
|
||||
response = JSON.build do |json|
|
||||
json.object do
|
||||
json.object do
|
||||
json.object do
|
||||
json.object do
|
||||
json.object do
|
||||
json.object do
|
||||
json.object do
|
||||
json.object do
|
||||
json.object do
|
||||
json.object do
|
||||
json.object do
|
||||
json.object do
|
||||
json.object do
|
||||
json.object do
|
||||
json.object do
|
||||
anything
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
response = JSON.parse(response)
|
||||
response
|
||||
)
|
||||
subject.catch(s).should be_valid
|
||||
end
|
||||
|
||||
context "uninitialized" do
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue