Skip to content

Commit bc8188d

Browse files
Fix issues with newlines when the tests execute on linux, by adding a NewLine property that uses the environment value.
1 parent 7efc162 commit bc8188d

File tree

4 files changed

+17
-14
lines changed

4 files changed

+17
-14
lines changed

.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* text=auto

tests/AutoStep.Compiler.Tests/DescriptionTests.cs

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ Line 3
4141

4242
await CompileAndAssert(TestFile, file => file
4343
.Feature("My Feature", 2, 15, feat => feat
44-
.Description("Description words\r\nLine 2\r\nLine 3")
44+
.Description($"Description words{NewLine}Line 2{NewLine}Line 3")
4545
));
4646
}
4747

@@ -60,7 +60,7 @@ Line 5
6060

6161
await CompileAndAssert(TestFile, file => file
6262
.Feature("My Feature", 2, 15, feat => feat
63-
.Description("Line 1\r\n Line 2\r\n Line 3\r\n Line 4\r\nLine 5")
63+
.Description($"Line 1{NewLine} Line 2{NewLine} Line 3{NewLine} Line 4{NewLine}Line 5")
6464
));
6565
}
6666

@@ -83,7 +83,7 @@ Line 5
8383

8484
await CompileAndAssert(TestFile, file => file
8585
.Feature("My Feature", 2, 15, feat => feat
86-
.Description("Line 1\r\n\r\n Line 2\r\n\r\n Line 3\r\n\r\n Line 4\r\n\r\nLine 5")
86+
.Description($"Line 1{NewLine}{NewLine} Line 2{NewLine}{NewLine} Line 3{NewLine}{NewLine} Line 4{NewLine}{NewLine}Line 5")
8787
));
8888
}
8989

@@ -107,7 +107,7 @@ Line 5
107107

108108
await CompileAndAssert(TestFile, file => file
109109
.Feature("My Feature", 2, 15, feat => feat
110-
.Description("Line 1\r\n\r\n Line 2\r\n\r\n Line 3\r\n\r\n Line 4\r\n\r\nLine 5")
110+
.Description($"Line 1{NewLine}{NewLine} Line 2{NewLine}{NewLine} Line 3{NewLine}{NewLine} Line 4{NewLine}{NewLine}Line 5")
111111
));
112112
}
113113

@@ -128,7 +128,7 @@ Line 2
128128

129129
await CompileAndAssert(TestFile, file => file
130130
.Feature("My Feature", 2, 15, feat => feat
131-
.Description("Line 1\r\n Line 2")
131+
.Description($"Line 1{NewLine} Line 2")
132132
));
133133
}
134134

@@ -151,7 +151,7 @@ Line 2
151151

152152
await CompileAndAssert(TestFile, file => file
153153
.Feature("My Feature", 2, 15, feat => feat
154-
.Description("Line 1\r\n Line 2")
154+
.Description($"Line 1{NewLine} Line 2")
155155
));
156156
}
157157

@@ -192,7 +192,7 @@ Line 3
192192
await CompileAndAssert(TestFile, file =>
193193
file.Feature("My Feature", 2, 15, feat => feat
194194
.Scenario("My Scenario", 4, 17, scen => scen
195-
.Description("Line 1\r\nLine 2\r\nLine 3")
195+
.Description($"Line 1{NewLine}Line 2{NewLine}Line 3")
196196
)));
197197
}
198198

@@ -214,7 +214,7 @@ Given I have
214214
await CompileAndAssert(TestFile, file =>
215215
file.Feature("My Feature", 2, 15, feat => feat
216216
.Scenario("My Scenario", 4, 17, scen => scen
217-
.Description("Line 1\r\nLine 2\r\nLine 3")
217+
.Description($"Line 1{NewLine}Line 2{NewLine}Line 3")
218218
.Given("I have", 9, 21)
219219
)));
220220
}
@@ -239,7 +239,7 @@ Given I have
239239
await CompileAndAssert(TestFile, file =>
240240
file.Feature("My Feature", 2, 15, feat => feat
241241
.Scenario("My Scenario", 4, 17, scen => scen
242-
.Description("Line 1\r\n Line 2\r\n Line 3\r\n Line 4\r\nLine 5")
242+
.Description($"Line 1{NewLine} Line 2{NewLine} Line 3{NewLine} Line 4{NewLine}Line 5")
243243
.Given("I have", 11, 21)
244244
)));
245245
}
@@ -266,7 +266,7 @@ Line 5
266266
await CompileAndAssert(TestFile, file =>
267267
file.Feature("My Feature", 2, 15, feat => feat
268268
.Scenario("My Scenario", 4, 17, scen => scen
269-
.Description("Line 1\r\n\r\n Line 2\r\n\r\n Line 3\r\n\r\n Line 4\r\n\r\nLine 5")
269+
.Description($"Line 1{NewLine}{NewLine} Line 2{NewLine}{NewLine} Line 3{NewLine}{NewLine} Line 4{NewLine}{NewLine}Line 5")
270270
)));
271271
}
272272

@@ -295,7 +295,7 @@ Given I have
295295
await CompileAndAssert(TestFile, file =>
296296
file.Feature("My Feature", 2, 15, feat => feat
297297
.Scenario("My Scenario", 4, 17, scen => scen
298-
.Description("Line 1\r\n\r\n Line 2\r\n\r\n Line 3\r\n\r\n Line 4\r\n\r\nLine 5")
298+
.Description($"Line 1{NewLine}{NewLine} Line 2{NewLine}{NewLine} Line 3{NewLine}{NewLine} Line 4{NewLine}{NewLine}Line 5")
299299
.Given("I have", 16, 17)
300300
)));
301301
}
@@ -321,7 +321,7 @@ Line 2
321321
await CompileAndAssert(TestFile, file =>
322322
file.Feature("My Feature", 2, 15, feat => feat
323323
.Scenario("My Scenario", 4, 17, scen => scen
324-
.Description("Line 1\r\n Line 2")
324+
.Description($"Line 1{NewLine} Line 2")
325325
)));
326326
}
327327

@@ -346,7 +346,7 @@ Line 2
346346
await CompileAndAssert(TestFile, file =>
347347
file.Feature("My Feature", 2, 15, feat => feat
348348
.Scenario("My Scenario", 5, 17, scen => scen
349-
.Description("Line 1\r\n Line 2")
349+
.Description($"Line 1{NewLine} Line 2")
350350
)));
351351
}
352352
}

tests/AutoStep.Compiler.Tests/FullFileTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ await CompileAndAssertSuccess(Files.SingleScenarioSimple, file => file
2727
.Option("Option1", "Setting 2", 3, 1)
2828
.Tag("Tag1", 6, 1)
2929
.Tag("Tag2", 7, 1)
30-
.Description("This is a description only\r\npartly this is part of the description")
30+
.Description($"This is a description only{NewLine}partly this is part of the description")
3131
.Scenario("Setup", 16, 3, scen => scen
3232
.Tag("scenariotag", 14, 3)
3333
.Option("scenarioinstruction", 15, 3)

tests/AutoStep.Compiler.Tests/Utils/CompilerTestBase.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ public class CompilerTestBase
1616
{
1717
protected ITestOutputHelper TestOutput { get; }
1818

19+
protected string NewLine => Environment.NewLine;
20+
1921
protected CompilerTestBase(ITestOutputHelper output)
2022
{
2123
TestOutput = output;

0 commit comments

Comments
 (0)