Add test for !shouldfail and failed benchmarks

This commit is contained in:
Martin Hořeňovský 2021-08-21 00:06:31 +02:00
parent 7f3297f7e8
commit 1cbbc5d2cb
No known key found for this signature in database
GPG Key ID: DE48307B8B0D381A
2 changed files with 15 additions and 0 deletions

View File

@ -359,6 +359,16 @@ set_tests_properties("Benchmarking::FailureReporting::FailMacro"
FAIL_REGULAR_EXPRESSION "successes=\"1\""
)
add_test(NAME "Benchmarking::FailureReporting::ShouldFailIsRespected"
COMMAND
$<TARGET_FILE:SelfTest> "Failing benchmark respects should-fail"
)
set_tests_properties("Benchmarking::FailureReporting::ShouldFailIsRespected"
PROPERTIES
PASS_REGULAR_EXPRESSION "1 failed as expected"
)
if (CATCH_USE_VALGRIND)
add_test(NAME ValgrindRunTests COMMAND valgrind --leak-check=full --error-exitcode=1 $<TARGET_FILE:SelfTest>)
add_test(NAME ValgrindListTests COMMAND valgrind --leak-check=full --error-exitcode=1 $<TARGET_FILE:SelfTest> --list-tests --verbosity high)

View File

@ -433,3 +433,8 @@ TEST_CASE("Failing benchmarks", "[!benchmark][.approvals]") {
};
}
}
TEST_CASE( "Failing benchmark respects should-fail",
"[!shouldfail][!benchmark][.approvals]" ) {
BENCHMARK( "Asserting benchmark" ) { REQUIRE( 1 == 2 ); };
}