diff options
| author | Martin Hořeňovský | 2021-12-12 15:18:50 +0100 |
|---|---|---|
| committer | Martin Hořeňovský | 2021-12-18 20:49:47 +0100 |
| commit | 08939cc8bb01ec84ea01d83cf03e4edb8484460c (patch) | |
| tree | c76fb6b66de1a515f0bb2cbd970602263ad45bfa /tests | |
| parent | 3bfe900bbc3f2f066737922c7194a8e2e27a2cda (diff) | |
| download | catch3-08939cc8bb01ec84ea01d83cf03e4edb8484460c.tar.gz | |
Error out early if invalid test specs are provided
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/CMakeLists.txt | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 47f86ebc..6a7563ec 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -294,14 +294,12 @@ set_tests_properties(TestsInFile::SimpleSpecs PROPERTIES PASS_REGULAR_EXPRESSION add_test(NAME TestsInFile::EscapeSpecialCharacters COMMAND $<TARGET_FILE:SelfTest> "-f ${SELF_TEST_DIR}/Misc/special-characters-in-file.input") set_tests_properties(TestsInFile::EscapeSpecialCharacters PROPERTIES PASS_REGULAR_EXPRESSION "1 assertion in 1 test case") -# CTest does not allow us to create an AND of required regular expressions, -# so we have to split the test into 2 parts and look for parts of the expected -# output separately. add_test(NAME TestsInFile::InvalidTestNames-1 COMMAND $<TARGET_FILE:SelfTest> "-f ${SELF_TEST_DIR}/Misc/invalid-test-names.input") -set_tests_properties(TestsInFile::InvalidTestNames-1 PROPERTIES PASS_REGULAR_EXPRESSION "Invalid Filter: \"Test with special, characters in \\\\\" name\"") - -add_test(NAME TestsInFile::InvalidTestNames-2 COMMAND $<TARGET_FILE:SelfTest> "-f ${SELF_TEST_DIR}/Misc/invalid-test-names.input") -set_tests_properties(TestsInFile::InvalidTestNames-2 PROPERTIES PASS_REGULAR_EXPRESSION "No tests ran") +set_tests_properties(TestsInFile::InvalidTestNames-1 + PROPERTIES + PASS_REGULAR_EXPRESSION "Invalid Filter: \"Test with special, characters in \\\\\" name\"" + FAIL_REGULAR_EXPRESSION "No tests ran" +) add_test(NAME TagAlias COMMAND $<TARGET_FILE:SelfTest> [@tricky] --list-tests) set_tests_properties(TagAlias PROPERTIES @@ -371,6 +369,16 @@ set_tests_properties("Benchmarking::FailureReporting::ShouldFailIsRespected" PASS_REGULAR_EXPRESSION "1 failed as expected" ) +add_test(NAME "ErrorHandling::InvalidTestSpecExitsEarly" + COMMAND + $<TARGET_FILE:SelfTest> "[aa,a]" +) +set_tests_properties("ErrorHandling::InvalidTestSpecExitsEarly" + PROPERTIES + PASS_REGULAR_EXPRESSION "Invalid Filter: \\[aa\,a\\]" + FAIL_REGULAR_EXPRESSION "No tests ran" +) + if (CATCH_USE_VALGRIND) add_test(NAME ValgrindRunTests COMMAND valgrind --leak-check=full --error-exitcode=1 $<TARGET_FILE:SelfTest>) |