Replace joiner unittest with one that doesn't suffer from issue 9131.

This commit is contained in:
H. S. Teoh 2012-12-16 21:33:02 -08:00
parent e471f8ee13
commit 3a2377ccd3

View file

@ -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