Skip to content

Commit ef7218b

Browse files
authored
Style multi-line assert_error specs using heredocs (#16093)
1 parent 08ceb0a commit ef7218b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+1822
-2519
lines changed

spec/compiler/codegen/experimental_spec.cr

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,29 +22,26 @@ describe "Code gen: experimental" do
2222
end
2323

2424
it "errors if invalid argument type" do
25-
assert_error %(
25+
assert_error <<-CRYSTAL, "first argument must be a String"
2626
@[Experimental(42)]
2727
def foo
2828
end
29-
),
30-
"first argument must be a String"
29+
CRYSTAL
3130
end
3231

3332
it "errors if too many arguments" do
34-
assert_error %(
33+
assert_error <<-CRYSTAL, "wrong number of experimental annotation arguments (given 2, expected 1)"
3534
@[Experimental("lorem ipsum", "extra arg")]
3635
def foo
3736
end
38-
),
39-
"wrong number of experimental annotation arguments (given 2, expected 1)"
37+
CRYSTAL
4038
end
4139

4240
it "errors if missing link arguments" do
43-
assert_error %(
41+
assert_error <<-CRYSTAL, "too many named arguments (given 1, expected maximum 0)"
4442
@[Experimental(invalid: "lorem ipsum")]
4543
def foo
4644
end
47-
),
48-
"too many named arguments (given 1, expected maximum 0)"
45+
CRYSTAL
4946
end
5047
end

spec/compiler/codegen/macro_spec.cr

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1091,7 +1091,7 @@ describe "Code gen: macro" do
10911091
end
10921092

10931093
it "errors if dynamic constant assignment after macro expansion" do
1094-
assert_error %(
1094+
assert_error <<-CRYSTAL, "dynamic constant assignment. Constants can only be declared at the top level or inside other types."
10951095
macro foo
10961096
X = 123
10971097
end
@@ -1101,8 +1101,7 @@ describe "Code gen: macro" do
11011101
end
11021102
11031103
bar
1104-
),
1105-
"dynamic constant assignment. Constants can only be declared at the top level or inside other types."
1104+
CRYSTAL
11061105
end
11071106

11081107
it "finds macro from virtual type" do

0 commit comments

Comments
 (0)