Skip to content

Commit

Permalink
Do not run all tests when no tests match TESTS
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
cjolowicz committed Nov 24, 2019
1 parent cc735a6 commit 99d0e51
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions test/utils
Original file line number Diff line number Diff line change
Expand Up @@ -274,5 +274,12 @@ if [ -n "$TESTS" ]; then
fi
done
unset shunit_func_

if [ -z "$__shunit_suite" ]; then
testNoop() {
echo "Skipping tests because they do not match TESTS."
}
suite_addTest testNoop
fi
}
fi

0 comments on commit 99d0e51

Please sign in to comment.