Add tests for empty range

This commit is contained in:
Eduard Staniloiu 2016-12-19 20:50:59 +02:00
parent b9d271d52c
commit e1c5362995

View file

@ -4836,7 +4836,7 @@ if (isInputRange!Range && is(typeof(binaryFun!pred(r.front, r.front)) == bool))
}
///
@safe unittest
@trusted unittest
{
import std.algorithm.comparison : equal;
@ -4857,6 +4857,16 @@ if (isInputRange!Range && is(typeof(binaryFun!pred(r.front, r.front)) == bool))
r.popBack;
assert(r.back == S(1, "a"));
assert(r.front == r.back);
r.popBack;
assert(r.empty);
import std.exception : assertThrown;
assertThrown!Error(r.front);
assertThrown!Error(r.back);
assertThrown!Error(r.popFront);
assertThrown!Error(r.popBack);
}
private struct UniqResult(alias pred, Range)