mirror of
https://github.com/dlang/phobos.git
synced 2025-05-09 13:02:30 +03:00
Add tests for empty range
This commit is contained in:
parent
b9d271d52c
commit
e1c5362995
1 changed files with 11 additions and 1 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue