Use more natural way to define error with custom loc

This commit is contained in:
Vitalii Elenhaupt 2018-01-28 20:06:04 +02:00 committed by V. Elenhaupt
parent 1d436fbb94
commit 55b66e7975
9 changed files with 22 additions and 27 deletions

View file

@ -18,7 +18,7 @@ module Ameba::Formatter
context "when problems found" do
it "reports an error" do
s = Source.new "a = 1", "source.cr"
s.error DummyRule.new, s.location(1, 2), "message"
s.error DummyRule.new, 1, 2, "message"
subject = flycheck
subject.source_finished s
subject.output.to_s.should eq "source.cr:1:2: E: message\n"
@ -26,7 +26,7 @@ module Ameba::Formatter
it "properly reports multi-line message" do
s = Source.new "a = 1", "source.cr"
s.error DummyRule.new, s.location(1, 2), "multi\nline"
s.error DummyRule.new, 1, 2, "multi\nline"
subject = flycheck
subject.source_finished s
subject.output.to_s.should eq "source.cr:1:2: E: multi line\n"

View file

@ -6,7 +6,7 @@ module Ameba
formatter = Formatter::TODOFormatter.new IO::Memory.new, file
s = Source.new "a = 1", "source.cr"
s.error DummyRule.new, s.location(1, 2), "message"
s.error DummyRule.new, 1, 2, "message"
formatter.finished [s]
file.to_s
@ -57,7 +57,7 @@ module Ameba
formatter = Formatter::TODOFormatter.new IO::Memory.new, file
s = Source.new "def invalid_syntax"
s.error Rule::Syntax.new, s.location(1, 2), "message"
s.error Rule::Syntax.new, 1, 2, "message"
formatter.finished [s]
content = file.to_s