mirror of
https://gitea.invidious.io/iv-org/shard-ameba.git
synced 2024-08-15 00:53:29 +00:00
Re-run autocorrect until all correctable issues have been corrected
This commit is contained in:
parent
573881cb8a
commit
f39a7a4cd4
12 changed files with 78 additions and 60 deletions
|
@ -69,24 +69,24 @@ module Ameba::Formatter
|
|||
|
||||
describe "#affected_code" do
|
||||
it "returns nil if there is no such a line number" do
|
||||
source = Source.new %(
|
||||
code = <<-EOF
|
||||
a = 1
|
||||
)
|
||||
EOF
|
||||
location = Crystal::Location.new("filename", 2, 1)
|
||||
subject.affected_code(source, location).should be_nil
|
||||
subject.affected_code(code, location).should be_nil
|
||||
end
|
||||
|
||||
it "returns correct line if it is found" do
|
||||
source = Source.new %(
|
||||
code = <<-EOF
|
||||
a = 1
|
||||
)
|
||||
EOF
|
||||
location = Crystal::Location.new("filename", 1, 1)
|
||||
subject.deansify(subject.affected_code(source, location))
|
||||
subject.deansify(subject.affected_code(code, location))
|
||||
.should eq "> a = 1\n ^\n"
|
||||
end
|
||||
|
||||
it "returns correct line if it is found" do
|
||||
source = Source.new <<-EOF
|
||||
code = <<-EOF
|
||||
# pre:1
|
||||
# pre:2
|
||||
# pre:3
|
||||
|
@ -101,7 +101,7 @@ module Ameba::Formatter
|
|||
EOF
|
||||
|
||||
location = Crystal::Location.new("filename", 6, 1)
|
||||
subject.deansify(subject.affected_code(source, location, context_lines: 3))
|
||||
subject.deansify(subject.affected_code(code, location, context_lines: 3))
|
||||
.should eq <<-STR
|
||||
> # pre:3
|
||||
> # pre:4
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue