git.lucas.co / cce-compositor
Wayland compositor (wlroots)
git clone https://git.lucas.co/cce-compositor.git

commit9c71b3698145a0409af59259c8376620e2fc0c4b
parentb164cfd32e
authorIsaac Freund <[email protected]>
date2020-04-04 15:37
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);
+    }
 }