mirror of
https://github.com/dlang/phobos.git
synced 2025-04-27 05:30:33 +03:00
Fixes #21629
* nicer assert * fixing the cov linter hints * forgot some dead code
This commit is contained in:
parent
81a968dee6
commit
fac12450fb
1 changed files with 33 additions and 0 deletions
33
std/csv.d
33
std/csv.d
|
@ -890,6 +890,12 @@ public:
|
|||
_separator = delimiter;
|
||||
_quote = quote;
|
||||
|
||||
if (_input.range.empty)
|
||||
{
|
||||
_empty = true;
|
||||
return;
|
||||
}
|
||||
|
||||
prime();
|
||||
}
|
||||
|
||||
|
@ -920,6 +926,12 @@ public:
|
|||
_separator = delimiter;
|
||||
_quote = quote;
|
||||
|
||||
if (_input.range.empty)
|
||||
{
|
||||
_empty = true;
|
||||
return;
|
||||
}
|
||||
|
||||
size_t[string] colToIndex;
|
||||
foreach (h; colHeaders)
|
||||
{
|
||||
|
@ -1207,6 +1219,7 @@ public:
|
|||
_input = input;
|
||||
_separator = delimiter;
|
||||
_quote = quote;
|
||||
|
||||
_front = appender!(dchar[])();
|
||||
_popCount = indices.dup;
|
||||
|
||||
|
@ -1750,3 +1763,23 @@ if (isSomeChar!Separator && isInputRange!Range
|
|||
++i;
|
||||
}
|
||||
}
|
||||
|
||||
// https://issues.dlang.org/show_bug.cgi?id=21629
|
||||
@safe pure unittest
|
||||
{
|
||||
import std.typecons : Tuple;
|
||||
struct Reccord
|
||||
{
|
||||
string a;
|
||||
string b;
|
||||
}
|
||||
|
||||
auto header = ["a" ,"b"];
|
||||
string input = "";
|
||||
assert(csvReader!Reccord(input).empty, "This should be empty");
|
||||
assert(csvReader!Reccord(input, header).empty, "This should be empty");
|
||||
assert(csvReader!(Tuple!(string,string))(input).empty, "This should be empty");
|
||||
assert(csvReader!(string[string])(input, header).empty, "This should be empty");
|
||||
assert(csvReader!(string[string])(input, null).empty, "This should be empty");
|
||||
assert(csvReader!(int)(input, null).empty, "This should be empty");
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue