mirror of
https://gitea.invidious.io/iv-org/shard-ameba.git
synced 2024-08-15 00:53:29 +00:00
Use more natural way to define error with custom loc
This commit is contained in:
parent
1d436fbb94
commit
55b66e7975
9 changed files with 22 additions and 27 deletions
|
@ -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"
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue