diff --git a/projects/CMakeLists.txt b/projects/CMakeLists.txt index 0a14006c..cbe21fcf 100644 --- a/projects/CMakeLists.txt +++ b/projects/CMakeLists.txt @@ -435,11 +435,20 @@ set_tests_properties(FilenameAsTagsTest PROPERTIES PASS_REGULAR_EXPRESSION "\\[# add_test(NAME EscapeSpecialCharactersInTestNames COMMAND $ "Test with special\\, characters \"in name") set_tests_properties(EscapeSpecialCharactersInTestNames PROPERTIES PASS_REGULAR_EXPRESSION "1 assertion in 1 test case") -add_test(NAME SpecialCharactersInTestNamesFromFile COMMAND $ "-f ${CATCH_DIR}/projects/SelfTest/Misc/special-characters-in-file.input") -set_tests_properties(SpecialCharactersInTestNamesFromFile PROPERTIES PASS_REGULAR_EXPRESSION "1 assertion in 1 test case") +add_test(NAME TestsInFile::SimpleSpecs COMMAND $ "-f ${CATCH_DIR}/projects/SelfTest/Misc/plain-old-tests.input") +set_tests_properties(TestsInFile::SimpleSpecs PROPERTIES PASS_REGULAR_EXPRESSION "6 assertions in 2 test cases") -add_test(NAME RunningTestsFromFile COMMAND $ "-f ${CATCH_DIR}/projects/SelfTest/Misc/plain-old-tests.input") -set_tests_properties(RunningTestsFromFile PROPERTIES PASS_REGULAR_EXPRESSION "6 assertions in 2 test cases") +add_test(NAME TestsInFile::EscapeSpecialCharacters COMMAND $ "-f ${CATCH_DIR}/projects/SelfTest/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 $ "-f ${CATCH_DIR}/projects/SelfTest/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 $ "-f ${CATCH_DIR}/projects/SelfTest/Misc/invalid-test-names.input") +set_tests_properties(TestsInFile::InvalidTestNames-2 PROPERTIES PASS_REGULAR_EXPRESSION "No tests ran") if (CATCH_USE_VALGRIND) diff --git a/projects/SelfTest/Misc/invalid-test-names.input b/projects/SelfTest/Misc/invalid-test-names.input new file mode 100644 index 00000000..e2bc88ec --- /dev/null +++ b/projects/SelfTest/Misc/invalid-test-names.input @@ -0,0 +1 @@ +Test with special, characters in \" name