From 5f7333e85167ecba4fcaacc559b474e512f254c5 Mon Sep 17 00:00:00 2001 From: Isaac Freund Date: Sat, 4 Apr 2020 15:37:40 +0200 Subject: [PATCH] Add empty iteration tests --- src/view_stack.zig | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/view_stack.zig b/src/view_stack.zig index d544f32..a8ec530 100644 --- a/src/view_stack.zig +++ b/src/view_stack.zig @@ -337,6 +337,12 @@ test "iteration" { 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 { var it = ViewStack.reverseIterator(views.last, 0xFFFFFFFF); @@ -365,6 +371,12 @@ test "iteration" { 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 { 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() == null); } + + // Iteration over (pending) tags that aren't present + { + var it = ViewStack.pendingIterator(views.first, 1 << 2); + testing.expect(it.next() == null); + } }