Skip to content

Commit 95c6c6d

Browse files
committed
Fix Markdown tests with trailing whitespace
As we save files with trailing white-space removed, the markdown parser tests that depends on the text with trailing white-space fails. So, to prevent any future formatting changes affecting the test result, we'll replace the actual trailing space(s) with an interpolated variable containing those trailing space(s).
1 parent fd903ac commit 95c6c6d

File tree

1 file changed

+13
-9
lines changed

1 file changed

+13
-9
lines changed

UnitTests/UnitTests.UWP/Markdown/Parse/ParagraphTests.cs

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,9 @@ line 1
3636
public void Paragraph_NoLineBreak_OneSpace()
3737
{
3838
// A line break in the markup does not translate to a line break in the resulting formatted text.
39-
AssertEqual(CollapseWhitespace(@"
40-
line 1
39+
var space = " ";
40+
AssertEqual(CollapseWhitespace($@"
41+
line 1{space}
4142
line 2"),
4243
new ParagraphBlock().AddChildren(
4344
new TextRunInline { Text = "line 1 line 2" }));
@@ -48,9 +49,10 @@ line 1
4849
public void Paragraph_LineBreak()
4950
{
5051
// Two spaces at the end of the line results in a line break.
51-
AssertEqual(CollapseWhitespace(@"
52-
line 1
53-
line 2 with *italic
52+
var spaces = " ";
53+
AssertEqual(CollapseWhitespace($@"
54+
line 1{spaces}
55+
line 2 with *italic{spaces}
5456
formatting*"),
5557
new ParagraphBlock().AddChildren(
5658
new TextRunInline { Text = "line 1\r\nline 2 with " },
@@ -63,8 +65,9 @@ line 2 with *italic
6365
public void Paragraph_LineBreak_ThreeSpaces()
6466
{
6567
// Three spaces at the end of the line also results in a line break.
66-
AssertEqual(CollapseWhitespace(@"
67-
line 1
68+
var spaces = " ";
69+
AssertEqual(CollapseWhitespace($@"
70+
line 1{spaces}
6871
line 2"),
6972
new ParagraphBlock().AddChildren(
7073
new TextRunInline { Text = "line 1 \r\nline 2" }));
@@ -90,9 +93,10 @@ line 1
9093
public void Paragraph_NewParagraph_Whitespace()
9194
{
9295
// A line that contains only whitespace starts a new paragraph.
93-
AssertEqual(CollapseWhitespace(@"
96+
var spaces = " ";
97+
AssertEqual(CollapseWhitespace($@"
9498
line 1
95-
99+
{spaces}
96100
line 2"),
97101
new ParagraphBlock().AddChildren(
98102
new TextRunInline { Text = "line 1" }),

0 commit comments

Comments
 (0)