From 3a476716ebaf665733d2d65009f71c8aa1972a08 Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Thu, 25 Dec 2025 18:29:02 -0500 Subject: [PATCH] tests: allow specifying 'at least 1 occurrence' for assert_output_contains --- tests/unit/test_helper.bash | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tests/unit/test_helper.bash b/tests/unit/test_helper.bash index 1669d5c29..95e89376d 100644 --- a/tests/unit/test_helper.bash +++ b/tests/unit/test_helper.bash @@ -148,6 +148,14 @@ assert_output_contains() { input="${input/$expected/}" found=$((found + 1)) done + + if [[ "$count" -eq -1 ]]; then + if [[ "$found" -gt 0 ]]; then + return 0 + fi + flunk "expected at least 1 occurrence of '$expected', found $found" + fi + [[ "$count" -eq "$found" ]] || flunk "expected $count occurrences of '$expected', found $found" }