mirror of
https://github.com/catchorg/Catch2.git
synced 2025-08-01 21:05:39 +02:00
Improve error messages for TEST_CASE tag parsing errors
Also removes a duplicated test case checking for empty tag error. Related to #2650
This commit is contained in:
@@ -98,7 +98,20 @@ TEST_CASE( "Test case with identical tags keeps just one", "[tags]" ) {
|
||||
REQUIRE( testCase.tags[0] == Tag( "tag1" ) );
|
||||
}
|
||||
|
||||
TEST_CASE( "Empty tag is not allowed" ) {
|
||||
REQUIRE_THROWS( Catch::TestCaseInfo(
|
||||
"", { "fake test name", "[]" }, dummySourceLineInfo ) );
|
||||
TEST_CASE("Mismatched square brackets in tags are caught and reported",
|
||||
"[tags][approvals]") {
|
||||
using Catch::TestCaseInfo;
|
||||
using Catch::Matchers::ContainsSubstring;
|
||||
REQUIRE_THROWS_WITH( TestCaseInfo( "",
|
||||
{ "test with unclosed tag", "[abc" },
|
||||
dummySourceLineInfo ),
|
||||
ContainsSubstring("registering test case 'test with unclosed tag'") );
|
||||
REQUIRE_THROWS_WITH( TestCaseInfo( "",
|
||||
{ "test with nested tags", "[abc[def]]" },
|
||||
dummySourceLineInfo ),
|
||||
ContainsSubstring("registering test case 'test with nested tags'") );
|
||||
REQUIRE_THROWS_WITH( TestCaseInfo( "",
|
||||
{ "test with superfluous close tags", "[abc][def]]" },
|
||||
dummySourceLineInfo ),
|
||||
ContainsSubstring("registering test case 'test with superfluous close tags'") );
|
||||
}
|
||||
|
Reference in New Issue
Block a user