Commit 9aba76364fcb4755930856a7bafc5294ed3ee944

Patrick Steinhardt 2017-06-07T10:59:31

tests: iterator_helpers: assert number of iterator items When the function `expect_iterator_items` surpasses the number of expected items, we simply break the loop. This causes us to trigger an assert later on which has message attached, which is annoying when trying to locate the root error cause. Instead, directly assert that the current count is still smaller or equal to the expected count inside of the loop.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
diff --git a/tests/iterator/iterator_helpers.c b/tests/iterator/iterator_helpers.c
index ae48fcd..68d5741 100644
--- a/tests/iterator/iterator_helpers.c
+++ b/tests/iterator/iterator_helpers.c
@@ -51,8 +51,7 @@ void expect_iterator_items(
 				cl_assert(entry->mode != GIT_FILEMODE_TREE);
 		}
 
-		if (++count >= expected_flat)
-			break;
+		cl_assert(++count <= expected_flat);
 	}
 
 	assert_at_end(i, v);