Add empty iteration tests

This commit is contained in:
Isaac Freund 2020-04-04 15:37:40 +02:00
parent 6cb9f6ac04
commit 5f7333e851
No known key found for this signature in database
GPG Key ID: 86DED400DDFD7A11

View File

@ -337,6 +337,12 @@ test "iteration" {
testing.expect(it.next() == null); testing.expect(it.next() == null);
} }
// Iteration over tags that aren't present
{
var it = ViewStack.iterator(views.first, 1 << 2);
testing.expect(it.next() == null);
}
// Reverse iteration over all tags // Reverse iteration over all tags
{ {
var it = ViewStack.reverseIterator(views.last, 0xFFFFFFFF); var it = ViewStack.reverseIterator(views.last, 0xFFFFFFFF);
@ -365,6 +371,12 @@ test "iteration" {
testing.expect(it.next() == null); testing.expect(it.next() == null);
} }
// Reverse iteration over tags that aren't present
{
var it = ViewStack.reverseIterator(views.first, 1 << 2);
testing.expect(it.next() == null);
}
// Iteration over (pending) 'a' tags // Iteration over (pending) 'a' tags
{ {
var it = ViewStack.pendingIterator(views.first, 1 << 0); var it = ViewStack.pendingIterator(views.first, 1 << 0);
@ -381,4 +393,10 @@ test "iteration" {
testing.expect(it.next() == &one_a_pb.view); testing.expect(it.next() == &one_a_pb.view);
testing.expect(it.next() == null); testing.expect(it.next() == null);
} }
// Iteration over (pending) tags that aren't present
{
var it = ViewStack.pendingIterator(views.first, 1 << 2);
testing.expect(it.next() == null);
}
} }