Skip to content

Commit de5c1e1

Browse files
author
Gideon de Swardt
committed
Fix unit test with platform agnostic line breaks
This commit resolves the issue of failing unit tests caused by Windows specific newline breaks in a non-Windows environment. The Windows newline breaks have been replaced with the platform-agnostic Environment.NewLine, ensuring compatibility across different operating systems.
1 parent 8d044c7 commit de5c1e1

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

src/ExCSS.Tests/Sheet.cs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
namespace ExCSS.Tests
1+
using System;
2+
3+
namespace ExCSS.Tests
24
{
35
using ExCSS;
46
using Xunit;
@@ -981,7 +983,7 @@ public void CssParseMsViewPortWithUnknownRules()
981983
var css = "@-ms-viewport{width:device-width} .dsip { display: block; }";
982984
var doc = ParseStyleSheet(css, true, true, true, true);
983985
var result = doc.ToCss();
984-
Assert.Equal("@-ms-viewport{width:device-width}\r\n.dsip { display: block }", result);
986+
Assert.Equal($"@-ms-viewport{{width:device-width}}{Environment.NewLine}.dsip {{ display: block }}", result);
985987
}
986988

987989
[Fact]
@@ -990,7 +992,7 @@ public void CssParseMediaAndMsViewPortWithoutOptions()
990992
var css = "@media screen and (max-width: 400px) { @-ms-viewport { width: 320px; } } .dsip { display: block; }";
991993
var doc = ParseStyleSheet(css);
992994
var result = doc.ToCss();
993-
Assert.Equal("@media screen and (max-width: 400px) { }\r\n.dsip { display: block }", result);
995+
Assert.Equal($"@media screen and (max-width: 400px) {{ }}{Environment.NewLine}.dsip {{ display: block }}", result);
994996
}
995997

996998
[Fact]
@@ -999,7 +1001,7 @@ public void CssParseMediaAndMsViewPortWithUnknownRules()
9991001
var css = "@media screen and (max-width: 400px) { @-ms-viewport { width: 320px; } } .dsip { display: block; }";
10001002
var doc = ParseStyleSheet(css, true, true, true, true);
10011003
var result = doc.ToCss();
1002-
Assert.Equal("@media screen and (max-width: 400px) { @-ms-viewport { width: 320px; } }\r\n.dsip { display: block }", result);
1004+
Assert.Equal($"@media screen and (max-width: 400px) {{ @-ms-viewport {{ width: 320px; }} }}{Environment.NewLine}.dsip {{ display: block }}", result);
10031005
}
10041006

10051007
[Fact]

0 commit comments

Comments
 (0)