Consistently use CRYSTAL marker for heredocs with crystal code

This commit is contained in:
Sijawusz Pur Rahnama 2022-12-08 13:57:46 +01:00
parent 2cb8c1381f
commit 071a8b7afb
2 changed files with 10 additions and 10 deletions

View file

@ -39,7 +39,7 @@ module Ameba::Formatter
describe "#context" do
it "returns correct pre/post context lines" do
source = Source.new <<-EOF
source = Source.new <<-CRYSTAL
# pre:1
# pre:2
# pre:3
@ -51,7 +51,7 @@ module Ameba::Formatter
# post:3
# post:4
# post:5
EOF
CRYSTAL
subject.context(source.lines, lineno: 6, context_lines: 3)
.should eq({<<-PRE.lines, <<-POST.lines
@ -69,24 +69,24 @@ module Ameba::Formatter
describe "#affected_code" do
it "returns nil if there is no such a line number" do
code = <<-EOF
code = <<-CRYSTAL
a = 1
EOF
CRYSTAL
location = Crystal::Location.new("filename", 2, 1)
subject.affected_code(code, location).should be_nil
end
it "returns correct line if it is found" do
code = <<-EOF
code = <<-CRYSTAL
a = 1
EOF
CRYSTAL
location = Crystal::Location.new("filename", 1, 1)
subject.deansify(subject.affected_code(code, location))
.should eq "> a = 1\n ^\n"
end
it "returns correct line if it is found" do
code = <<-EOF
code = <<-CRYSTAL
# pre:1
# pre:2
# pre:3
@ -98,7 +98,7 @@ module Ameba::Formatter
# post:3
# post:4
# post:5
EOF
CRYSTAL
location = Crystal::Location.new("filename", 6, 1)
subject.deansify(subject.affected_code(code, location, context_lines: 3))

View file

@ -2,7 +2,7 @@ require "../../../spec_helper"
module Ameba::Rule::Metrics
subject = CyclomaticComplexity.new
complex_method = <<-CODE
complex_method = <<-CRYSTAL
def hello(a, b, c)
if a && b && c
begin
@ -15,7 +15,7 @@ module Ameba::Rule::Metrics
end
end
end
CODE
CRYSTAL
describe CyclomaticComplexity do
it "passes for empty methods" do