Skip to content

Commit

Permalink
Fix issue with test where data file was being adjusted by git checkin…
Browse files Browse the repository at this point in the history
…/out lineend policy. Move data into C# with escaped newlines.
  • Loading branch information
MarkPflug committed Jan 7, 2025
1 parent c14be86 commit 834e824
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
7 changes: 5 additions & 2 deletions source/Sylvan.Data.Csv.Tests/CsvDataReaderTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,10 @@ public async Task PartialRecord()
[Fact]
public async Task Quoted()
{
using (var reader = File.OpenText("Data/Quote.csv"))
var data =
"Id,Name,Value,Date\n1,John,\"Very\nLow\n\",2000-11-11\n2,Jane,\"\"\"High\"\"\",\"1989-03-14\"\n3,Comma,\"Quite, Common\",2020-05-29\n";

using (var reader = new StringReader(data))
{
var csv = await CsvDataReader.CreateAsync(reader);
Assert.Equal(4, csv.FieldCount);
Expand All @@ -166,7 +169,7 @@ public async Task Quoted()
Assert.Equal(1, csv.RowNumber);
Assert.Equal("1", csv[0]);
Assert.Equal("John", csv[1]);
Assert.Equal($"Very{Environment.NewLine}Low{Environment.NewLine}", csv[2]);
Assert.Equal($"Very\nLow\n", csv[2]);
Assert.Equal("2000-11-11", csv[3]);
Assert.True(await csv.ReadAsync());
Assert.Equal(2, csv.RowNumber);
Expand Down
6 changes: 0 additions & 6 deletions source/Sylvan.Data.Csv.Tests/Data/Quote.csv

This file was deleted.

0 comments on commit 834e824

Please sign in to comment.