D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 21629 - std.csv report one record on empty input
Summary: std.csv report one record on empty input
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: phobos (show other issues)
Version: D2
Hardware: All All
: P3 enhancement
Assignee: No Owner
URL: http://dlang.org/
Keywords: pull
Depends on:
Blocks:
 
Reported: 2021-02-11 13:09 UTC by deadalnix
Modified: 2021-02-22 20:03 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description deadalnix 2021-02-11 13:09:34 UTC
I have the following dumbed down sample:

struct Reccord {
  string a;
  string b;
}

import std.csv;
string input = "";
foreach (reccord; cvsReader!Reccord(input)) {
  assert(0, "No reccord are expected");
}

This sample code trips the assert as cvsReccord emit one empty record with an empty a and b. I think this is erroneous.
Comment 1 Robert Schadek 2021-02-11 14:19:22 UTC
I'll take a look
Comment 2 Dlang Bot 2021-02-11 14:58:40 UTC
@burner created dlang/phobos pull request #7788 "Fixes #21629" fixing this issue:

- Fixes #21629

https://github.com/dlang/phobos/pull/7788
Comment 3 Dlang Bot 2021-02-22 20:03:04 UTC
dlang/phobos pull request #7788 "Fixes #21629: std.csv report one record on empty input" was merged into master:

- fac12450fbf6b707976cc84694e94c3c363bc75f by Robert burner Schadek:
  Fixes #21629
  
  * nicer assert
  * fixing the cov linter hints
  * forgot some dead code

https://github.com/dlang/phobos/pull/7788