Skip to content

Commit

Permalink
Fixed test that fails on non-Windows env because of \r\n constant in …
Browse files Browse the repository at this point in the history
…expected outputs
  • Loading branch information
VitaliyMF committed Jun 11, 2024
1 parent 9ceaeed commit 5a47082
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/NReco.Csv.Tests/CsvWriterTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public void CsvWriterTest() {
csvWriter.NextRecord();

var expected = "AAA,\"A\"\"AA\",\" AAA \",\"Something, again\",\"Something\nonce more\"\r\nJust one value\r\n";
Assert.Equal(expected, strWr.ToString());
Assert.Equal(applyEnvNewLine(expected), strWr.ToString());

strWr = new StringWriter();
csvWriter = new CsvWriter(strWr);
Expand All @@ -44,10 +44,11 @@ public void CsvWriterTest() {
csvWriter.NextRecord();

expected = ", ,\"\"\"\", aa \r\n";
Assert.Equal(expected, strWr.ToString());
Assert.Equal(applyEnvNewLine(expected), strWr.ToString());
}


// to keep test env-independent let's use platform-specific NewLine constant
string applyEnvNewLine(string s) => s.Replace("\r\n", Environment.NewLine);

}
}

0 comments on commit 5a47082

Please sign in to comment.