mirror of
https://gitea.invidious.io/iv-org/shard-ameba.git
synced 2024-08-15 00:53:29 +00:00
Show affected code while using a default formatter
This commit is contained in:
parent
148044f479
commit
f671d6f857
7 changed files with 89 additions and 11 deletions
|
@ -50,6 +50,37 @@ module Ameba::Formatter
|
|||
log.should contain "NamedRuleError"
|
||||
end
|
||||
|
||||
it "writes affected code by default" do
|
||||
output.clear
|
||||
s = Source.new(%(
|
||||
a = 22
|
||||
puts a
|
||||
)).tap do |source|
|
||||
source.add_issue(DummyRule.new, {1, 5}, "DummyRuleError")
|
||||
end
|
||||
subject.finished [s]
|
||||
log = output.to_s
|
||||
log.should contain "> a = 22"
|
||||
log.should contain " \e[33m^\e[0m"
|
||||
end
|
||||
|
||||
it "doesn't write affected code if it is disabled" do
|
||||
output.clear
|
||||
s = Source.new(%(
|
||||
a = 22
|
||||
puts a
|
||||
)).tap do |source|
|
||||
source.add_issue(DummyRule.new, {1, 5}, "DummyRuleError")
|
||||
end
|
||||
|
||||
formatter = DotFormatter.new output
|
||||
formatter.config[:without_affected_code] = true
|
||||
formatter.finished [s]
|
||||
log = output.to_s
|
||||
log.should_not contain "> a = 22"
|
||||
log.should_not contain " \e[33m^\e[0m"
|
||||
end
|
||||
|
||||
it "does not write disabled issues" do
|
||||
s = Source.new ""
|
||||
s.add_issue(DummyRule.new, location: {1, 1},
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue