Buffered read fills buffer if final value is missing
kentcb opened this issue · 0 comments
kentcb commented
The following test fails (read
is 100
, not 2
):
[Fact]
public async void kbcsv_repro()
{
var csv = @"Col1,Col2,Col3
val1,val2,val3
val1,val2,";
using (var reader = CsvReader.FromCsvString(csv))
{
await reader.ReadHeaderRecordAsync();
var buffer = new DataRecord[100];
var read = await reader.ReadDataRecordsAsync(buffer, 0, buffer.Length);
Assert.Equal(2, read);
}
}
Including a final value or a new line is enough to make the test pass, but neither should be required.