mirror of
https://github.com/dlang/phobos.git
synced 2025-05-03 16:40:48 +03:00
Don't need to loop over subranges to use equal().
I wrote it that way 'cos if the subrange is a distinct type from the original range, equal won't compare them properly (compiler will complain about == not being defined). But in this case, it does work, so I rewrote it to use equal() directly.
This commit is contained in:
parent
cd9696a8e8
commit
78b9a6fd00
1 changed files with 2 additions and 11 deletions
|
@ -2614,11 +2614,7 @@ unittest
|
|||
{
|
||||
// Issue 10773
|
||||
auto s = splitter("abc", "");
|
||||
auto expected = ["a", "b", "c"];
|
||||
foreach (e; s) {
|
||||
assert(e.equal(expected.front));
|
||||
expected.popFront();
|
||||
}
|
||||
assert(s.equal(["a", "b", "c"]));
|
||||
}
|
||||
|
||||
unittest
|
||||
|
@ -2636,12 +2632,7 @@ unittest
|
|||
auto sep = new RefSep("->");
|
||||
auto data = "i->am->pointing";
|
||||
auto words = splitter(data, sep);
|
||||
auto expected = [ "i", "am", "pointing" ];
|
||||
foreach (w; words) {
|
||||
assert(w == expected.front);
|
||||
expected.popFront();
|
||||
}
|
||||
assert(expected.empty);
|
||||
assert(words.equal([ "i", "am", "pointing" ]));
|
||||
}
|
||||
|
||||
auto splitter(alias isTerminator, Range)(Range input)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue