Fix matching of non-lowercase filename tags

The bug was caused by forgetting to lower-case the filename tag
for matching against test spec.

Fixes #2064
This commit is contained in:
Martin Hořeňovský 2020-10-22 16:17:34 +02:00
parent 0c7f96ba63
commit 8878f90323
No known key found for this signature in database
GPG Key ID: DE48307B8B0D381A
2 changed files with 7 additions and 0 deletions

View File

@ -190,6 +190,9 @@ namespace Catch {
std::string combined("#");
combined += extractFilenamePart(lineInfo.file);
internalAppendTag(combined);
// TBD: Running this over all tags again is inefficient, but
// simple enough. In practice, the overhead is small enough.
toLowerInPlace(backingLCaseTags);
}
std::string TestCaseInfo::tagsAsString() const {

View File

@ -181,6 +181,10 @@ set_tests_properties(LibIdentityTest PROPERTIES PASS_REGULAR_EXPRESSION "descrip
add_test(NAME FilenameAsTagsTest COMMAND $<TARGET_FILE:SelfTest> -\# --list-tags)
set_tests_properties(FilenameAsTagsTest PROPERTIES PASS_REGULAR_EXPRESSION "\\[#Approx.tests\\]")
# Check that the filename tags can also be matched against (#2064)
add_test(NAME FilenameAsTagsMatching COMMAND $<TARGET_FILE:SelfTest> -\# --list-tags [\#Approx.tests])
set_tests_properties(FilenameAsTagsMatching PROPERTIES PASS_REGULAR_EXPRESSION "\\[#Approx.tests\\]")
add_test(NAME EscapeSpecialCharactersInTestNames COMMAND $<TARGET_FILE:SelfTest> "Test with special\\, characters \"in name")
set_tests_properties(EscapeSpecialCharactersInTestNames PROPERTIES PASS_REGULAR_EXPRESSION "1 assertion in 1 test case")