From d6c0efedfbdceda13eacdecf0540a35981fa17cc Mon Sep 17 00:00:00 2001 From: Chris Sarbora Date: Wed, 29 Nov 2023 22:21:00 -0800 Subject: [PATCH] Improve naming for TEMPLATE_LIST_TEST_CASE_METHOD It's not often very useful to name tests simply by incrementing numbers. This change adds a mechanism by which a name can be generated using both the index of the type in the type list, and also some from the type itself somehow. --- .../internal/catch_template_test_registry.hpp | 14 ++++++- .../Baselines/automake.sw.approved.txt | 3 ++ .../Baselines/automake.sw.multi.approved.txt | 3 ++ .../Baselines/compact.sw.approved.txt | 7 +++- .../Baselines/compact.sw.multi.approved.txt | 7 +++- .../Baselines/console.std.approved.txt | 4 +- .../Baselines/console.sw.approved.txt | 37 ++++++++++++++++++- .../Baselines/console.sw.multi.approved.txt | 37 ++++++++++++++++++- .../SelfTest/Baselines/junit.sw.approved.txt | 5 ++- .../Baselines/junit.sw.multi.approved.txt | 5 ++- .../Baselines/sonarqube.sw.approved.txt | 3 ++ .../Baselines/sonarqube.sw.multi.approved.txt | 3 ++ tests/SelfTest/Baselines/tap.sw.approved.txt | 8 +++- .../Baselines/tap.sw.multi.approved.txt | 8 +++- .../Baselines/teamcity.sw.approved.txt | 6 +++ .../Baselines/teamcity.sw.multi.approved.txt | 6 +++ tests/SelfTest/Baselines/xml.sw.approved.txt | 37 ++++++++++++++++++- .../Baselines/xml.sw.multi.approved.txt | 37 ++++++++++++++++++- .../UsageTests/CustomNaming.tests.cpp | 17 +++++++++ 19 files changed, 227 insertions(+), 20 deletions(-) diff --git a/src/catch2/internal/catch_template_test_registry.hpp b/src/catch2/internal/catch_template_test_registry.hpp index 7abc684d49..cf8d888998 100644 --- a/src/catch2/internal/catch_template_test_registry.hpp +++ b/src/catch2/internal/catch_template_test_registry.hpp @@ -185,9 +185,10 @@ template \ struct TestName { \ void reg_tests() { \ + using Catch::IndexedTestTypeName; \ size_t index = 0; \ using expander = size_t[]; \ - (void)expander{(Catch::AutoReg( Catch::makeTestInvoker( &TestFunc ), CATCH_INTERNAL_LINEINFO, Catch::StringRef(), Catch::NameAndTags{ Name INTERNAL_CATCH_CONFIG_NAME_SEPARATOR INTERNAL_CATCH_STRINGIZE(TmplList) INTERNAL_CATCH_CONFIG_NAME_SEPARATOR + std::to_string(index), Tags } ), index++)... };/* NOLINT */\ + (void)expander{(Catch::AutoReg( Catch::makeTestInvoker( &TestFunc ), CATCH_INTERNAL_LINEINFO, Catch::StringRef(), Catch::NameAndTags{ Name INTERNAL_CATCH_CONFIG_NAME_SEPARATOR INTERNAL_CATCH_STRINGIZE(TmplList) INTERNAL_CATCH_CONFIG_NAME_SEPARATOR + IndexedTestTypeName{}(index), Tags } ), index++)... };/* NOLINT */\ } \ };\ static int INTERNAL_CATCH_UNIQUE_NAME( globalRegistrar ) = [](){ \ @@ -320,9 +321,10 @@ template\ struct TestNameClass{\ void reg_tests(){\ + using Catch::IndexedTestTypeName;\ size_t index = 0;\ using expander = size_t[];\ - (void)expander{(Catch::AutoReg( Catch::makeTestInvoker( &TestName::test ), CATCH_INTERNAL_LINEINFO, #ClassName##_catch_sr, Catch::NameAndTags{ Name INTERNAL_CATCH_CONFIG_NAME_SEPARATOR INTERNAL_CATCH_STRINGIZE(TmplList) INTERNAL_CATCH_CONFIG_NAME_SEPARATOR + std::to_string(index), Tags } ), index++)... };/* NOLINT */ \ + (void)expander{(Catch::AutoReg( Catch::makeTestInvoker( &TestName::test ), CATCH_INTERNAL_LINEINFO, #ClassName##_catch_sr, Catch::NameAndTags{ Name INTERNAL_CATCH_CONFIG_NAME_SEPARATOR INTERNAL_CATCH_STRINGIZE(TmplList) INTERNAL_CATCH_CONFIG_NAME_SEPARATOR + IndexedTestTypeName{}(index), Tags } ), index++)... };/* NOLINT */ \ }\ };\ static int INTERNAL_CATCH_UNIQUE_NAME( globalRegistrar ) = [](){\ @@ -339,5 +341,13 @@ #define INTERNAL_CATCH_TEMPLATE_LIST_TEST_CASE_METHOD(ClassName, Name, Tags, TmplList) \ INTERNAL_CATCH_TEMPLATE_LIST_TEST_CASE_METHOD_2( INTERNAL_CATCH_UNIQUE_NAME( CATCH2_INTERNAL_TEMPLATE_TEST_ ), INTERNAL_CATCH_UNIQUE_NAME( CATCH2_INTERNAL_TEMPLATE_TEST_ ), ClassName, Name, Tags, TmplList ) +namespace Catch { + template + struct IndexedTestTypeName { + std::string operator()(size_t index) const { + return std::to_string(index); + } + }; +} #endif // CATCH_TEMPLATE_TEST_REGISTRY_HPP_INCLUDED diff --git a/tests/SelfTest/Baselines/automake.sw.approved.txt b/tests/SelfTest/Baselines/automake.sw.approved.txt index 74026a47af..653c6e02e6 100644 --- a/tests/SelfTest/Baselines/automake.sw.approved.txt +++ b/tests/SelfTest/Baselines/automake.sw.approved.txt @@ -258,6 +258,9 @@ Message from section two :test-result: FAIL Tabs and newlines show in output :test-result: PASS Tag alias can be registered against tag patterns :test-result: PASS Tags with spaces and non-alphanumerical characters are accepted +:test-result: PASS Template list test case with specialized IndexedTestTypeName--NamedTypes--A +:test-result: PASS Template list test case with specialized IndexedTestTypeName--NamedTypes--B +:test-result: PASS Template list test case with specialized IndexedTestTypeName--NamedTypes--C :test-result: PASS Template test case method with test types specified inside std::tuple - MyTypes - 0 :test-result: PASS Template test case method with test types specified inside std::tuple - MyTypes - 1 :test-result: PASS Template test case method with test types specified inside std::tuple - MyTypes - 2 diff --git a/tests/SelfTest/Baselines/automake.sw.multi.approved.txt b/tests/SelfTest/Baselines/automake.sw.multi.approved.txt index dca0f6920b..2ed2e0f175 100644 --- a/tests/SelfTest/Baselines/automake.sw.multi.approved.txt +++ b/tests/SelfTest/Baselines/automake.sw.multi.approved.txt @@ -251,6 +251,9 @@ :test-result: FAIL Tabs and newlines show in output :test-result: PASS Tag alias can be registered against tag patterns :test-result: PASS Tags with spaces and non-alphanumerical characters are accepted +:test-result: PASS Template list test case with specialized IndexedTestTypeName--NamedTypes--A +:test-result: PASS Template list test case with specialized IndexedTestTypeName--NamedTypes--B +:test-result: PASS Template list test case with specialized IndexedTestTypeName--NamedTypes--C :test-result: PASS Template test case method with test types specified inside std::tuple - MyTypes - 0 :test-result: PASS Template test case method with test types specified inside std::tuple - MyTypes - 1 :test-result: PASS Template test case method with test types specified inside std::tuple - MyTypes - 2 diff --git a/tests/SelfTest/Baselines/compact.sw.approved.txt b/tests/SelfTest/Baselines/compact.sw.approved.txt index 48614f9fa5..12dff0d677 100644 --- a/tests/SelfTest/Baselines/compact.sw.approved.txt +++ b/tests/SelfTest/Baselines/compact.sw.approved.txt @@ -1744,6 +1744,9 @@ Tag.tests.cpp:: passed: registry.add( "@no square bracket at start] Tag.tests.cpp:: passed: registry.add( "[@no square bracket at end", "", Catch::SourceLineInfo( "file", 3 ) ) Tag.tests.cpp:: passed: testCase.tags.size() == 2 for: 2 == 2 Tag.tests.cpp:: passed: testCase.tags, VectorContains( Tag( "tag with spaces" ) ) && VectorContains( Tag( "I said \"good day\" sir!"_catch_sr ) ) for: { {?}, {?} } ( Contains: {?} and Contains: {?} ) +CustomNaming.tests.cpp:: passed: Template_Foo{}.size() == 0 for: 0 == 0 +CustomNaming.tests.cpp:: passed: Template_Foo{}.size() == 0 for: 0 == 0 +CustomNaming.tests.cpp:: passed: Template_Foo{}.size() == 0 for: 0 == 0 Class.tests.cpp:: passed: Template_Fixture::m_a == 1 for: 1 == 1 Class.tests.cpp:: passed: Template_Fixture::m_a == 1 for: 1 == 1 Class.tests.cpp:: passed: Template_Fixture::m_a == 1 for: 1.0 == 1 @@ -2700,7 +2703,7 @@ InternalBenchmark.tests.cpp:: passed: med == 18. for: 18.0 == 18.0 InternalBenchmark.tests.cpp:: passed: q3 == 23. for: 23.0 == 23.0 Misc.tests.cpp:: passed: Misc.tests.cpp:: passed: -test cases: 432 | 327 passed | 85 failed | 6 skipped | 14 failed as expected -assertions: 2271 | 2090 passed | 146 failed | 35 failed as expected +test cases: 435 | 330 passed | 85 failed | 6 skipped | 14 failed as expected +assertions: 2274 | 2093 passed | 146 failed | 35 failed as expected diff --git a/tests/SelfTest/Baselines/compact.sw.multi.approved.txt b/tests/SelfTest/Baselines/compact.sw.multi.approved.txt index 405201d159..c06686eea6 100644 --- a/tests/SelfTest/Baselines/compact.sw.multi.approved.txt +++ b/tests/SelfTest/Baselines/compact.sw.multi.approved.txt @@ -1737,6 +1737,9 @@ Tag.tests.cpp:: passed: registry.add( "@no square bracket at start] Tag.tests.cpp:: passed: registry.add( "[@no square bracket at end", "", Catch::SourceLineInfo( "file", 3 ) ) Tag.tests.cpp:: passed: testCase.tags.size() == 2 for: 2 == 2 Tag.tests.cpp:: passed: testCase.tags, VectorContains( Tag( "tag with spaces" ) ) && VectorContains( Tag( "I said \"good day\" sir!"_catch_sr ) ) for: { {?}, {?} } ( Contains: {?} and Contains: {?} ) +CustomNaming.tests.cpp:: passed: Template_Foo{}.size() == 0 for: 0 == 0 +CustomNaming.tests.cpp:: passed: Template_Foo{}.size() == 0 for: 0 == 0 +CustomNaming.tests.cpp:: passed: Template_Foo{}.size() == 0 for: 0 == 0 Class.tests.cpp:: passed: Template_Fixture::m_a == 1 for: 1 == 1 Class.tests.cpp:: passed: Template_Fixture::m_a == 1 for: 1 == 1 Class.tests.cpp:: passed: Template_Fixture::m_a == 1 for: 1.0 == 1 @@ -2689,7 +2692,7 @@ InternalBenchmark.tests.cpp:: passed: med == 18. for: 18.0 == 18.0 InternalBenchmark.tests.cpp:: passed: q3 == 23. for: 23.0 == 23.0 Misc.tests.cpp:: passed: Misc.tests.cpp:: passed: -test cases: 432 | 327 passed | 85 failed | 6 skipped | 14 failed as expected -assertions: 2271 | 2090 passed | 146 failed | 35 failed as expected +test cases: 435 | 330 passed | 85 failed | 6 skipped | 14 failed as expected +assertions: 2274 | 2093 passed | 146 failed | 35 failed as expected diff --git a/tests/SelfTest/Baselines/console.std.approved.txt b/tests/SelfTest/Baselines/console.std.approved.txt index 4830f26318..24a20d4ba7 100644 --- a/tests/SelfTest/Baselines/console.std.approved.txt +++ b/tests/SelfTest/Baselines/console.std.approved.txt @@ -1588,6 +1588,6 @@ due to unexpected exception with message: Why would you throw a std::string? =============================================================================== -test cases: 432 | 341 passed | 70 failed | 7 skipped | 14 failed as expected -assertions: 2254 | 2090 passed | 129 failed | 35 failed as expected +test cases: 435 | 344 passed | 70 failed | 7 skipped | 14 failed as expected +assertions: 2257 | 2093 passed | 129 failed | 35 failed as expected diff --git a/tests/SelfTest/Baselines/console.sw.approved.txt b/tests/SelfTest/Baselines/console.sw.approved.txt index 0b467c1079..280f6fd176 100644 --- a/tests/SelfTest/Baselines/console.sw.approved.txt +++ b/tests/SelfTest/Baselines/console.sw.approved.txt @@ -11749,6 +11749,39 @@ Tag.tests.cpp:: PASSED: with expansion: { {?}, {?} } ( Contains: {?} and Contains: {?} ) +------------------------------------------------------------------------------- +Template list test case with specialized IndexedTestTypeName--NamedTypes--A +------------------------------------------------------------------------------- +CustomNaming.tests.cpp: +............................................................................... + +CustomNaming.tests.cpp:: PASSED: + REQUIRE( Template_Foo{}.size() == 0 ) +with expansion: + 0 == 0 + +------------------------------------------------------------------------------- +Template list test case with specialized IndexedTestTypeName--NamedTypes--B +------------------------------------------------------------------------------- +CustomNaming.tests.cpp: +............................................................................... + +CustomNaming.tests.cpp:: PASSED: + REQUIRE( Template_Foo{}.size() == 0 ) +with expansion: + 0 == 0 + +------------------------------------------------------------------------------- +Template list test case with specialized IndexedTestTypeName--NamedTypes--C +------------------------------------------------------------------------------- +CustomNaming.tests.cpp: +............................................................................... + +CustomNaming.tests.cpp:: PASSED: + REQUIRE( Template_Foo{}.size() == 0 ) +with expansion: + 0 == 0 + ------------------------------------------------------------------------------- Template test case method with test types specified inside std::tuple - MyTypes - 0 @@ -18889,6 +18922,6 @@ Misc.tests.cpp: Misc.tests.cpp:: PASSED: =============================================================================== -test cases: 432 | 327 passed | 85 failed | 6 skipped | 14 failed as expected -assertions: 2271 | 2090 passed | 146 failed | 35 failed as expected +test cases: 435 | 330 passed | 85 failed | 6 skipped | 14 failed as expected +assertions: 2274 | 2093 passed | 146 failed | 35 failed as expected diff --git a/tests/SelfTest/Baselines/console.sw.multi.approved.txt b/tests/SelfTest/Baselines/console.sw.multi.approved.txt index dadd2e82b9..91c6a5cf8b 100644 --- a/tests/SelfTest/Baselines/console.sw.multi.approved.txt +++ b/tests/SelfTest/Baselines/console.sw.multi.approved.txt @@ -11742,6 +11742,39 @@ Tag.tests.cpp:: PASSED: with expansion: { {?}, {?} } ( Contains: {?} and Contains: {?} ) +------------------------------------------------------------------------------- +Template list test case with specialized IndexedTestTypeName--NamedTypes--A +------------------------------------------------------------------------------- +CustomNaming.tests.cpp: +............................................................................... + +CustomNaming.tests.cpp:: PASSED: + REQUIRE( Template_Foo{}.size() == 0 ) +with expansion: + 0 == 0 + +------------------------------------------------------------------------------- +Template list test case with specialized IndexedTestTypeName--NamedTypes--B +------------------------------------------------------------------------------- +CustomNaming.tests.cpp: +............................................................................... + +CustomNaming.tests.cpp:: PASSED: + REQUIRE( Template_Foo{}.size() == 0 ) +with expansion: + 0 == 0 + +------------------------------------------------------------------------------- +Template list test case with specialized IndexedTestTypeName--NamedTypes--C +------------------------------------------------------------------------------- +CustomNaming.tests.cpp: +............................................................................... + +CustomNaming.tests.cpp:: PASSED: + REQUIRE( Template_Foo{}.size() == 0 ) +with expansion: + 0 == 0 + ------------------------------------------------------------------------------- Template test case method with test types specified inside std::tuple - MyTypes - 0 @@ -18878,6 +18911,6 @@ Misc.tests.cpp: Misc.tests.cpp:: PASSED: =============================================================================== -test cases: 432 | 327 passed | 85 failed | 6 skipped | 14 failed as expected -assertions: 2271 | 2090 passed | 146 failed | 35 failed as expected +test cases: 435 | 330 passed | 85 failed | 6 skipped | 14 failed as expected +assertions: 2274 | 2093 passed | 146 failed | 35 failed as expected diff --git a/tests/SelfTest/Baselines/junit.sw.approved.txt b/tests/SelfTest/Baselines/junit.sw.approved.txt index 7f7dfa088e..39c81b769a 100644 --- a/tests/SelfTest/Baselines/junit.sw.approved.txt +++ b/tests/SelfTest/Baselines/junit.sw.approved.txt @@ -1,7 +1,7 @@ - + @@ -1336,6 +1336,9 @@ at Misc.tests.cpp: + + + diff --git a/tests/SelfTest/Baselines/junit.sw.multi.approved.txt b/tests/SelfTest/Baselines/junit.sw.multi.approved.txt index 7b6ba588d1..0f2e028a3c 100644 --- a/tests/SelfTest/Baselines/junit.sw.multi.approved.txt +++ b/tests/SelfTest/Baselines/junit.sw.multi.approved.txt @@ -1,6 +1,6 @@ - + @@ -1335,6 +1335,9 @@ at Misc.tests.cpp: + + + diff --git a/tests/SelfTest/Baselines/sonarqube.sw.approved.txt b/tests/SelfTest/Baselines/sonarqube.sw.approved.txt index efa3c77525..2d5371e7ac 100644 --- a/tests/SelfTest/Baselines/sonarqube.sw.approved.txt +++ b/tests/SelfTest/Baselines/sonarqube.sw.approved.txt @@ -904,6 +904,9 @@ at Condition.tests.cpp: + + + diff --git a/tests/SelfTest/Baselines/sonarqube.sw.multi.approved.txt b/tests/SelfTest/Baselines/sonarqube.sw.multi.approved.txt index 3b68498048..400119182e 100644 --- a/tests/SelfTest/Baselines/sonarqube.sw.multi.approved.txt +++ b/tests/SelfTest/Baselines/sonarqube.sw.multi.approved.txt @@ -903,6 +903,9 @@ at Condition.tests.cpp: + + + diff --git a/tests/SelfTest/Baselines/tap.sw.approved.txt b/tests/SelfTest/Baselines/tap.sw.approved.txt index 8cddee6c5b..e909adf05f 100644 --- a/tests/SelfTest/Baselines/tap.sw.approved.txt +++ b/tests/SelfTest/Baselines/tap.sw.approved.txt @@ -2825,6 +2825,12 @@ ok {test-number} - registry.add( "[@no square bracket at end", "", Catch::Source ok {test-number} - testCase.tags.size() == 2 for: 2 == 2 # Tags with spaces and non-alphanumerical characters are accepted ok {test-number} - testCase.tags, VectorContains( Tag( "tag with spaces" ) ) && VectorContains( Tag( "I said \"good day\" sir!"_catch_sr ) ) for: { {?}, {?} } ( Contains: {?} and Contains: {?} ) +# Template list test case with specialized IndexedTestTypeName--NamedTypes--A +ok {test-number} - Template_Foo{}.size() == 0 for: 0 == 0 +# Template list test case with specialized IndexedTestTypeName--NamedTypes--B +ok {test-number} - Template_Foo{}.size() == 0 for: 0 == 0 +# Template list test case with specialized IndexedTestTypeName--NamedTypes--C +ok {test-number} - Template_Foo{}.size() == 0 for: 0 == 0 # Template test case method with test types specified inside std::tuple - MyTypes - 0 ok {test-number} - Template_Fixture::m_a == 1 for: 1 == 1 # Template test case method with test types specified inside std::tuple - MyTypes - 1 @@ -4571,5 +4577,5 @@ ok {test-number} - q3 == 23. for: 23.0 == 23.0 ok {test-number} - # xmlentitycheck ok {test-number} - -1..2283 +1..2286 diff --git a/tests/SelfTest/Baselines/tap.sw.multi.approved.txt b/tests/SelfTest/Baselines/tap.sw.multi.approved.txt index 96ddb4f1e7..6da9d99e9f 100644 --- a/tests/SelfTest/Baselines/tap.sw.multi.approved.txt +++ b/tests/SelfTest/Baselines/tap.sw.multi.approved.txt @@ -2818,6 +2818,12 @@ ok {test-number} - registry.add( "[@no square bracket at end", "", Catch::Source ok {test-number} - testCase.tags.size() == 2 for: 2 == 2 # Tags with spaces and non-alphanumerical characters are accepted ok {test-number} - testCase.tags, VectorContains( Tag( "tag with spaces" ) ) && VectorContains( Tag( "I said \"good day\" sir!"_catch_sr ) ) for: { {?}, {?} } ( Contains: {?} and Contains: {?} ) +# Template list test case with specialized IndexedTestTypeName--NamedTypes--A +ok {test-number} - Template_Foo{}.size() == 0 for: 0 == 0 +# Template list test case with specialized IndexedTestTypeName--NamedTypes--B +ok {test-number} - Template_Foo{}.size() == 0 for: 0 == 0 +# Template list test case with specialized IndexedTestTypeName--NamedTypes--C +ok {test-number} - Template_Foo{}.size() == 0 for: 0 == 0 # Template test case method with test types specified inside std::tuple - MyTypes - 0 ok {test-number} - Template_Fixture::m_a == 1 for: 1 == 1 # Template test case method with test types specified inside std::tuple - MyTypes - 1 @@ -4560,5 +4566,5 @@ ok {test-number} - q3 == 23. for: 23.0 == 23.0 ok {test-number} - # xmlentitycheck ok {test-number} - -1..2283 +1..2286 diff --git a/tests/SelfTest/Baselines/teamcity.sw.approved.txt b/tests/SelfTest/Baselines/teamcity.sw.approved.txt index 33a702ba07..5745af134a 100644 --- a/tests/SelfTest/Baselines/teamcity.sw.approved.txt +++ b/tests/SelfTest/Baselines/teamcity.sw.approved.txt @@ -625,6 +625,12 @@ ##teamcity[testFinished name='Tag alias can be registered against tag patterns' duration="{duration}"] ##teamcity[testStarted name='Tags with spaces and non-alphanumerical characters are accepted'] ##teamcity[testFinished name='Tags with spaces and non-alphanumerical characters are accepted' duration="{duration}"] +##teamcity[testStarted name='Template list test case with specialized IndexedTestTypeName--NamedTypes--A'] +##teamcity[testFinished name='Template list test case with specialized IndexedTestTypeName--NamedTypes--A' duration="{duration}"] +##teamcity[testStarted name='Template list test case with specialized IndexedTestTypeName--NamedTypes--B'] +##teamcity[testFinished name='Template list test case with specialized IndexedTestTypeName--NamedTypes--B' duration="{duration}"] +##teamcity[testStarted name='Template list test case with specialized IndexedTestTypeName--NamedTypes--C'] +##teamcity[testFinished name='Template list test case with specialized IndexedTestTypeName--NamedTypes--C' duration="{duration}"] ##teamcity[testStarted name='Template test case method with test types specified inside std::tuple - MyTypes - 0'] ##teamcity[testFinished name='Template test case method with test types specified inside std::tuple - MyTypes - 0' duration="{duration}"] ##teamcity[testStarted name='Template test case method with test types specified inside std::tuple - MyTypes - 1'] diff --git a/tests/SelfTest/Baselines/teamcity.sw.multi.approved.txt b/tests/SelfTest/Baselines/teamcity.sw.multi.approved.txt index 3c4f43d0d5..aef23081f7 100644 --- a/tests/SelfTest/Baselines/teamcity.sw.multi.approved.txt +++ b/tests/SelfTest/Baselines/teamcity.sw.multi.approved.txt @@ -625,6 +625,12 @@ ##teamcity[testFinished name='Tag alias can be registered against tag patterns' duration="{duration}"] ##teamcity[testStarted name='Tags with spaces and non-alphanumerical characters are accepted'] ##teamcity[testFinished name='Tags with spaces and non-alphanumerical characters are accepted' duration="{duration}"] +##teamcity[testStarted name='Template list test case with specialized IndexedTestTypeName--NamedTypes--A'] +##teamcity[testFinished name='Template list test case with specialized IndexedTestTypeName--NamedTypes--A' duration="{duration}"] +##teamcity[testStarted name='Template list test case with specialized IndexedTestTypeName--NamedTypes--B'] +##teamcity[testFinished name='Template list test case with specialized IndexedTestTypeName--NamedTypes--B' duration="{duration}"] +##teamcity[testStarted name='Template list test case with specialized IndexedTestTypeName--NamedTypes--C'] +##teamcity[testFinished name='Template list test case with specialized IndexedTestTypeName--NamedTypes--C' duration="{duration}"] ##teamcity[testStarted name='Template test case method with test types specified inside std::tuple - MyTypes - 0'] ##teamcity[testFinished name='Template test case method with test types specified inside std::tuple - MyTypes - 0' duration="{duration}"] ##teamcity[testStarted name='Template test case method with test types specified inside std::tuple - MyTypes - 1'] diff --git a/tests/SelfTest/Baselines/xml.sw.approved.txt b/tests/SelfTest/Baselines/xml.sw.approved.txt index 1db23311aa..6ea087cad3 100644 --- a/tests/SelfTest/Baselines/xml.sw.approved.txt +++ b/tests/SelfTest/Baselines/xml.sw.approved.txt @@ -13675,6 +13675,39 @@ Message from section two + + + + Template_Foo<TestType>{}.size() == 0 + + + 0 == 0 + + + + + + + + Template_Foo<TestType>{}.size() == 0 + + + 0 == 0 + + + + + + + + Template_Foo<TestType>{}.size() == 0 + + + 0 == 0 + + + + @@ -21840,6 +21873,6 @@ b1! - - + + diff --git a/tests/SelfTest/Baselines/xml.sw.multi.approved.txt b/tests/SelfTest/Baselines/xml.sw.multi.approved.txt index 3d44c95806..17542e88f2 100644 --- a/tests/SelfTest/Baselines/xml.sw.multi.approved.txt +++ b/tests/SelfTest/Baselines/xml.sw.multi.approved.txt @@ -13675,6 +13675,39 @@ Message from section two + + + + Template_Foo<TestType>{}.size() == 0 + + + 0 == 0 + + + + + + + + Template_Foo<TestType>{}.size() == 0 + + + 0 == 0 + + + + + + + + Template_Foo<TestType>{}.size() == 0 + + + 0 == 0 + + + + @@ -21839,6 +21872,6 @@ b1! - - + + diff --git a/tests/SelfTest/UsageTests/CustomNaming.tests.cpp b/tests/SelfTest/UsageTests/CustomNaming.tests.cpp index 3f7e15817d..f2a5f3fa79 100644 --- a/tests/SelfTest/UsageTests/CustomNaming.tests.cpp +++ b/tests/SelfTest/UsageTests/CustomNaming.tests.cpp @@ -67,3 +67,20 @@ TEMPLATE_LIST_TEST_CASE_METHOD(Template_Fixture, "Template test case method with { REQUIRE( Template_Fixture::m_a == 1 ); } + + +// Creating an IndextTestTypeName specialization should alter how template list tests are named. +template struct NamedType {}; +namespace Catch { + template + struct IndexedTestTypeName> { + std::string operator()(size_t) const { + return {C}; + } + }; +} +using NamedTypes = std::tuple, NamedType<'B'>, NamedType<'C'>>; +TEMPLATE_LIST_TEST_CASE_METHOD(Template_Foo, "Template list test case with specialized IndexedTestTypeName", "[class][template][list][indexedtesttypename]", NamedTypes) +{ + REQUIRE( Template_Foo{}.size() == 0 ); +}