Skip to content

Commit 99d0e51

Browse files
committed
Do not run all tests when no tests match TESTS
Define a noop test function when TESTS is passed and no function in the test script matches the contents of TESTS. The noop function merely prints a line notifying the user that the tests were skipped. This happens because tests were split up into multiple test scripts, but the Makefile passes TESTS to all of them. When the `suite` hook does not invoke `suite_addTest`, shunit2 falls back to running all defined tests.
1 parent cc735a6 commit 99d0e51

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

test/utils

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -274,5 +274,12 @@ if [ -n "$TESTS" ]; then
274274
fi
275275
done
276276
unset shunit_func_
277+
278+
if [ -z "$__shunit_suite" ]; then
279+
testNoop() {
280+
echo "Skipping tests because they do not match TESTS."
281+
}
282+
suite_addTest testNoop
283+
fi
277284
}
278285
fi

0 commit comments

Comments
 (0)