Skip to content

Commit 736edaf

Browse files
committed
Fix cross-platform line ending issue in MarkdownFormatterTests
- Normalize line endings in markdown output before regex matching - Resolves Windows CI pipeline test failure - Ensures consistent behavior across Windows, macOS, and Linux
1 parent f4148a3 commit 736edaf

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

tests/DotNetApiDiff.Tests/Reporting/MarkdownFormatterTests.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -255,9 +255,10 @@ public void Format_OutputIsValidMarkdown()
255255
Assert.Matches(new Regex(@"^# .*$", RegexOptions.Multiline), markdown);
256256
Assert.Matches(new Regex(@"^## .*$", RegexOptions.Multiline), markdown);
257257

258-
// Tables should have header row and separator row
259-
Assert.Matches(new Regex(@"^\| .* \|$", RegexOptions.Multiline), markdown);
260-
Assert.Matches(new Regex(@"^\|\-+\|\-+\|", RegexOptions.Multiline), markdown);
258+
// Tables should have header row and separator row (normalize line endings for cross-platform compatibility)
259+
var normalizedMarkdown = markdown.Replace("\r\n", "\n").Replace("\r", "\n");
260+
Assert.Matches(new Regex(@"^\| .* \|$", RegexOptions.Multiline), normalizedMarkdown);
261+
Assert.Matches(new Regex(@"^\|\-+\|\-+\|", RegexOptions.Multiline), normalizedMarkdown);
261262

262263
// Code blocks should be properly formatted
263264
Assert.Matches(new Regex(@"```csharp\s.*\s```", RegexOptions.Singleline), markdown);

0 commit comments

Comments
 (0)