Skip to content

Commit e1c5362

Browse files
committed
Add tests for empty range
1 parent b9d271d commit e1c5362

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

std/algorithm/iteration.d

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4836,7 +4836,7 @@ if (isInputRange!Range && is(typeof(binaryFun!pred(r.front, r.front)) == bool))
48364836
}
48374837

48384838
///
4839-
@safe unittest
4839+
@trusted unittest
48404840
{
48414841
import std.algorithm.comparison : equal;
48424842

@@ -4857,6 +4857,16 @@ if (isInputRange!Range && is(typeof(binaryFun!pred(r.front, r.front)) == bool))
48574857
r.popBack;
48584858
assert(r.back == S(1, "a"));
48594859
assert(r.front == r.back);
4860+
4861+
r.popBack;
4862+
assert(r.empty);
4863+
4864+
import std.exception : assertThrown;
4865+
4866+
assertThrown!Error(r.front);
4867+
assertThrown!Error(r.back);
4868+
assertThrown!Error(r.popFront);
4869+
assertThrown!Error(r.popBack);
48604870
}
48614871

48624872
private struct UniqResult(alias pred, Range)

0 commit comments

Comments
 (0)