mirror of
https://github.com/dlang/phobos.git
synced 2025-04-30 15:10:46 +03:00
Replace joiner unittest with one that doesn't suffer from issue 9131.
This commit is contained in:
parent
e471f8ee13
commit
3a2377ccd3
1 changed files with 43 additions and 0 deletions
|
@ -2900,6 +2900,49 @@ unittest
|
||||||
assert(!equal(js2, js));
|
assert(!equal(js2, js));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
unittest
|
||||||
|
{
|
||||||
|
struct TransientRange
|
||||||
|
{
|
||||||
|
int[128] _buf;
|
||||||
|
int[][] _values;
|
||||||
|
this(int[][] values)
|
||||||
|
{
|
||||||
|
_values = values;
|
||||||
|
}
|
||||||
|
@property bool empty()
|
||||||
|
{
|
||||||
|
return _values.length == 0;
|
||||||
|
}
|
||||||
|
@property auto front()
|
||||||
|
{
|
||||||
|
foreach (i; 0 .. _values.front.length)
|
||||||
|
{
|
||||||
|
_buf[i] = _values[0][i];
|
||||||
|
}
|
||||||
|
return _buf[0 .. _values.front.length];
|
||||||
|
}
|
||||||
|
void popFront()
|
||||||
|
{
|
||||||
|
_values = _values[1 .. $];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
auto rr = TransientRange([[1,2], [3,4,5], [], [6,7]]);
|
||||||
|
|
||||||
|
// Can't use array() or equal() directly because they fail with transient
|
||||||
|
// .front.
|
||||||
|
int[] result;
|
||||||
|
foreach (c; rr.joiner()) {
|
||||||
|
result ~= c;
|
||||||
|
}
|
||||||
|
|
||||||
|
assert(equal(result, [1,2,3,4,5,6,7]));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Temporarily disable this unittest due to issue 9131 on OSX/64.
|
||||||
|
version = Issue9131;
|
||||||
|
version(Issue9131) {} else
|
||||||
unittest
|
unittest
|
||||||
{
|
{
|
||||||
struct TransientRange
|
struct TransientRange
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue