Skip to content

Commit d0006b0

Browse files
Fix multiline strings
1 parent 71eb10b commit d0006b0

File tree

6 files changed

+87
-48
lines changed

6 files changed

+87
-48
lines changed

exercises/practice/food-chain/.meta/Generator.tpl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@ public class {{ testClass }}
88
{
99
var expected =
1010
{{- for line in test.expected }}
11-
{{- if for.last -}}
12-
{{ line | string.literal }};
11+
{{ if for.last -}}
12+
{{ line | string.literal -}};
1313
{{- else -}}
1414
{{ line | string.append "\n" | string.literal }} +
15-
{{ end -}}
15+
{{- end -}}
1616
{{- end }}
1717
Assert.Equal(expected, {{ testedClass }}.{{ test.testedMethod }}({{ test.input.startVerse }}{{if test.input.endVerse != test.input.startVerse }}, {{ test.input.endVerse }}{{ end }}));
1818
}

exercises/practice/food-chain/FoodChainTests.cs

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,17 @@ public class FoodChainTests
55
[Fact]
66
public void Fly()
77
{
8-
var expected = "I know an old lady who swallowed a fly.\n" +
8+
var expected =
9+
"I know an old lady who swallowed a fly.\n" +
910
"I don't know why she swallowed the fly. Perhaps she'll die.";
1011
Assert.Equal(expected, FoodChain.Recite(1));
1112
}
1213

1314
[Fact(Skip = "Remove this Skip property to run this test")]
1415
public void Spider()
1516
{
16-
var expected = "I know an old lady who swallowed a spider.\n" +
17+
var expected =
18+
"I know an old lady who swallowed a spider.\n" +
1719
"It wriggled and jiggled and tickled inside her.\n" +
1820
"She swallowed the spider to catch the fly.\n" +
1921
"I don't know why she swallowed the fly. Perhaps she'll die.";
@@ -23,7 +25,8 @@ public void Spider()
2325
[Fact(Skip = "Remove this Skip property to run this test")]
2426
public void Bird()
2527
{
26-
var expected = "I know an old lady who swallowed a bird.\n" +
28+
var expected =
29+
"I know an old lady who swallowed a bird.\n" +
2730
"How absurd to swallow a bird!\n" +
2831
"She swallowed the bird to catch the spider that wriggled and jiggled and tickled inside her.\n" +
2932
"She swallowed the spider to catch the fly.\n" +
@@ -34,7 +37,8 @@ public void Bird()
3437
[Fact(Skip = "Remove this Skip property to run this test")]
3538
public void Cat()
3639
{
37-
var expected = "I know an old lady who swallowed a cat.\n" +
40+
var expected =
41+
"I know an old lady who swallowed a cat.\n" +
3842
"Imagine that, to swallow a cat!\n" +
3943
"She swallowed the cat to catch the bird.\n" +
4044
"She swallowed the bird to catch the spider that wriggled and jiggled and tickled inside her.\n" +
@@ -46,7 +50,8 @@ public void Cat()
4650
[Fact(Skip = "Remove this Skip property to run this test")]
4751
public void Dog()
4852
{
49-
var expected = "I know an old lady who swallowed a dog.\n" +
53+
var expected =
54+
"I know an old lady who swallowed a dog.\n" +
5055
"What a hog, to swallow a dog!\n" +
5156
"She swallowed the dog to catch the cat.\n" +
5257
"She swallowed the cat to catch the bird.\n" +
@@ -59,7 +64,8 @@ public void Dog()
5964
[Fact(Skip = "Remove this Skip property to run this test")]
6065
public void Goat()
6166
{
62-
var expected = "I know an old lady who swallowed a goat.\n" +
67+
var expected =
68+
"I know an old lady who swallowed a goat.\n" +
6369
"Just opened her throat and swallowed a goat!\n" +
6470
"She swallowed the goat to catch the dog.\n" +
6571
"She swallowed the dog to catch the cat.\n" +
@@ -73,7 +79,8 @@ public void Goat()
7379
[Fact(Skip = "Remove this Skip property to run this test")]
7480
public void Cow()
7581
{
76-
var expected = "I know an old lady who swallowed a cow.\n" +
82+
var expected =
83+
"I know an old lady who swallowed a cow.\n" +
7784
"I don't know how she swallowed a cow!\n" +
7885
"She swallowed the cow to catch the goat.\n" +
7986
"She swallowed the goat to catch the dog.\n" +
@@ -88,15 +95,17 @@ public void Cow()
8895
[Fact(Skip = "Remove this Skip property to run this test")]
8996
public void Horse()
9097
{
91-
var expected = "I know an old lady who swallowed a horse.\n" +
98+
var expected =
99+
"I know an old lady who swallowed a horse.\n" +
92100
"She's dead, of course!";
93101
Assert.Equal(expected, FoodChain.Recite(8));
94102
}
95103

96104
[Fact(Skip = "Remove this Skip property to run this test")]
97105
public void Multiple_verses()
98106
{
99-
var expected = "I know an old lady who swallowed a fly.\n" +
107+
var expected =
108+
"I know an old lady who swallowed a fly.\n" +
100109
"I don't know why she swallowed the fly. Perhaps she'll die.\n" +
101110
"\n" +
102111
"I know an old lady who swallowed a spider.\n" +
@@ -115,7 +124,8 @@ public void Multiple_verses()
115124
[Fact(Skip = "Remove this Skip property to run this test")]
116125
public void Full_song()
117126
{
118-
var expected = "I know an old lady who swallowed a fly.\n" +
127+
var expected =
128+
"I know an old lady who swallowed a fly.\n" +
119129
"I don't know why she swallowed the fly. Perhaps she'll die.\n" +
120130
"\n" +
121131
"I know an old lady who swallowed a spider.\n" +

exercises/practice/house/.meta/Generator.tpl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@ public class {{ testClass }}
88
{
99
var expected =
1010
{{- for line in test.expected }}
11-
{{- if for.last -}}
12-
{{ line | string.literal }};
11+
{{ if for.last -}}
12+
{{ line | string.literal -}};
1313
{{- else -}}
1414
{{ line | string.append "\n" | string.literal }} +
15-
{{ end -}}
15+
{{- end -}}
1616
{{- end }}
1717
Assert.Equal(expected, {{ testedClass }}.{{ test.testedMethod }}({{ test.input.startVerse }}{{if test.input.endVerse != test.input.startVerse }}, {{ test.input.endVerse }}{{ end }}));
1818
}

exercises/practice/house/HouseTests.cs

Lines changed: 28 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,91 +5,104 @@ public class HouseTests
55
[Fact]
66
public void Verse_one_the_house_that_jack_built()
77
{
8-
var expected = "This is the house that Jack built.";
8+
var expected =
9+
"This is the house that Jack built.";
910
Assert.Equal(expected, House.Recite(1));
1011
}
1112

1213
[Fact(Skip = "Remove this Skip property to run this test")]
1314
public void Verse_two_the_malt_that_lay()
1415
{
15-
var expected = "This is the malt that lay in the house that Jack built.";
16+
var expected =
17+
"This is the malt that lay in the house that Jack built.";
1618
Assert.Equal(expected, House.Recite(2));
1719
}
1820

1921
[Fact(Skip = "Remove this Skip property to run this test")]
2022
public void Verse_three_the_rat_that_ate()
2123
{
22-
var expected = "This is the rat that ate the malt that lay in the house that Jack built.";
24+
var expected =
25+
"This is the rat that ate the malt that lay in the house that Jack built.";
2326
Assert.Equal(expected, House.Recite(3));
2427
}
2528

2629
[Fact(Skip = "Remove this Skip property to run this test")]
2730
public void Verse_four_the_cat_that_killed()
2831
{
29-
var expected = "This is the cat that killed the rat that ate the malt that lay in the house that Jack built.";
32+
var expected =
33+
"This is the cat that killed the rat that ate the malt that lay in the house that Jack built.";
3034
Assert.Equal(expected, House.Recite(4));
3135
}
3236

3337
[Fact(Skip = "Remove this Skip property to run this test")]
3438
public void Verse_five_the_dog_that_worried()
3539
{
36-
var expected = "This is the dog that worried the cat that killed the rat that ate the malt that lay in the house that Jack built.";
40+
var expected =
41+
"This is the dog that worried the cat that killed the rat that ate the malt that lay in the house that Jack built.";
3742
Assert.Equal(expected, House.Recite(5));
3843
}
3944

4045
[Fact(Skip = "Remove this Skip property to run this test")]
4146
public void Verse_six_the_cow_with_the_crumpled_horn()
4247
{
43-
var expected = "This is the cow with the crumpled horn that tossed the dog that worried the cat that killed the rat that ate the malt that lay in the house that Jack built.";
48+
var expected =
49+
"This is the cow with the crumpled horn that tossed the dog that worried the cat that killed the rat that ate the malt that lay in the house that Jack built.";
4450
Assert.Equal(expected, House.Recite(6));
4551
}
4652

4753
[Fact(Skip = "Remove this Skip property to run this test")]
4854
public void Verse_seven_the_maiden_all_forlorn()
4955
{
50-
var expected = "This is the maiden all forlorn that milked the cow with the crumpled horn that tossed the dog that worried the cat that killed the rat that ate the malt that lay in the house that Jack built.";
56+
var expected =
57+
"This is the maiden all forlorn that milked the cow with the crumpled horn that tossed the dog that worried the cat that killed the rat that ate the malt that lay in the house that Jack built.";
5158
Assert.Equal(expected, House.Recite(7));
5259
}
5360

5461
[Fact(Skip = "Remove this Skip property to run this test")]
5562
public void Verse_eight_the_man_all_tattered_and_torn()
5663
{
57-
var expected = "This is the man all tattered and torn that kissed the maiden all forlorn that milked the cow with the crumpled horn that tossed the dog that worried the cat that killed the rat that ate the malt that lay in the house that Jack built.";
64+
var expected =
65+
"This is the man all tattered and torn that kissed the maiden all forlorn that milked the cow with the crumpled horn that tossed the dog that worried the cat that killed the rat that ate the malt that lay in the house that Jack built.";
5866
Assert.Equal(expected, House.Recite(8));
5967
}
6068

6169
[Fact(Skip = "Remove this Skip property to run this test")]
6270
public void Verse_nine_the_priest_all_shaven_and_shorn()
6371
{
64-
var expected = "This is the priest all shaven and shorn that married the man all tattered and torn that kissed the maiden all forlorn that milked the cow with the crumpled horn that tossed the dog that worried the cat that killed the rat that ate the malt that lay in the house that Jack built.";
72+
var expected =
73+
"This is the priest all shaven and shorn that married the man all tattered and torn that kissed the maiden all forlorn that milked the cow with the crumpled horn that tossed the dog that worried the cat that killed the rat that ate the malt that lay in the house that Jack built.";
6574
Assert.Equal(expected, House.Recite(9));
6675
}
6776

6877
[Fact(Skip = "Remove this Skip property to run this test")]
6978
public void Verse_10_the_rooster_that_crowed_in_the_morn()
7079
{
71-
var expected = "This is the rooster that crowed in the morn that woke the priest all shaven and shorn that married the man all tattered and torn that kissed the maiden all forlorn that milked the cow with the crumpled horn that tossed the dog that worried the cat that killed the rat that ate the malt that lay in the house that Jack built.";
80+
var expected =
81+
"This is the rooster that crowed in the morn that woke the priest all shaven and shorn that married the man all tattered and torn that kissed the maiden all forlorn that milked the cow with the crumpled horn that tossed the dog that worried the cat that killed the rat that ate the malt that lay in the house that Jack built.";
7282
Assert.Equal(expected, House.Recite(10));
7383
}
7484

7585
[Fact(Skip = "Remove this Skip property to run this test")]
7686
public void Verse_11_the_farmer_sowing_his_corn()
7787
{
78-
var expected = "This is the farmer sowing his corn that kept the rooster that crowed in the morn that woke the priest all shaven and shorn that married the man all tattered and torn that kissed the maiden all forlorn that milked the cow with the crumpled horn that tossed the dog that worried the cat that killed the rat that ate the malt that lay in the house that Jack built.";
88+
var expected =
89+
"This is the farmer sowing his corn that kept the rooster that crowed in the morn that woke the priest all shaven and shorn that married the man all tattered and torn that kissed the maiden all forlorn that milked the cow with the crumpled horn that tossed the dog that worried the cat that killed the rat that ate the malt that lay in the house that Jack built.";
7990
Assert.Equal(expected, House.Recite(11));
8091
}
8192

8293
[Fact(Skip = "Remove this Skip property to run this test")]
8394
public void Verse_12_the_horse_and_the_hound_and_the_horn()
8495
{
85-
var expected = "This is the horse and the hound and the horn that belonged to the farmer sowing his corn that kept the rooster that crowed in the morn that woke the priest all shaven and shorn that married the man all tattered and torn that kissed the maiden all forlorn that milked the cow with the crumpled horn that tossed the dog that worried the cat that killed the rat that ate the malt that lay in the house that Jack built.";
96+
var expected =
97+
"This is the horse and the hound and the horn that belonged to the farmer sowing his corn that kept the rooster that crowed in the morn that woke the priest all shaven and shorn that married the man all tattered and torn that kissed the maiden all forlorn that milked the cow with the crumpled horn that tossed the dog that worried the cat that killed the rat that ate the malt that lay in the house that Jack built.";
8698
Assert.Equal(expected, House.Recite(12));
8799
}
88100

89101
[Fact(Skip = "Remove this Skip property to run this test")]
90102
public void Multiple_verses()
91103
{
92-
var expected = "This is the cat that killed the rat that ate the malt that lay in the house that Jack built.\n" +
104+
var expected =
105+
"This is the cat that killed the rat that ate the malt that lay in the house that Jack built.\n" +
93106
"This is the dog that worried the cat that killed the rat that ate the malt that lay in the house that Jack built.\n" +
94107
"This is the cow with the crumpled horn that tossed the dog that worried the cat that killed the rat that ate the malt that lay in the house that Jack built.\n" +
95108
"This is the maiden all forlorn that milked the cow with the crumpled horn that tossed the dog that worried the cat that killed the rat that ate the malt that lay in the house that Jack built.\n" +
@@ -100,7 +113,8 @@ public void Multiple_verses()
100113
[Fact(Skip = "Remove this Skip property to run this test")]
101114
public void Full_rhyme()
102115
{
103-
var expected = "This is the house that Jack built.\n" +
116+
var expected =
117+
"This is the house that Jack built.\n" +
104118
"This is the malt that lay in the house that Jack built.\n" +
105119
"This is the rat that ate the malt that lay in the house that Jack built.\n" +
106120
"This is the cat that killed the rat that ate the malt that lay in the house that Jack built.\n" +

exercises/practice/twelve-days/.meta/Generator.tpl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@ public class {{ testClass }}
88
{
99
var expected =
1010
{{- for line in test.expected }}
11-
{{- if for.last -}}
12-
{{ line | string.literal }};
11+
{{ if for.last -}}
12+
{{ line | string.literal -}};
1313
{{- else -}}
1414
{{ line | string.append "\n" | string.literal }} +
15-
{{ end -}}
15+
{{- end -}}
1616
{{- end }}
1717
Assert.Equal(expected, {{ testedClass }}.{{ test.testedMethod }}({{ test.input.startVerse }}{{if test.input.endVerse != test.input.startVerse }}, {{ test.input.endVerse }}{{ end }}));
1818
}

0 commit comments

Comments
 (0)