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 c6fbbcfe8f..f013ccb0f2 100644 --- a/tests/SelfTest/Baselines/automake.sw.approved.txt +++ b/tests/SelfTest/Baselines/automake.sw.approved.txt @@ -259,6 +259,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 9a6f177b83..34cbeca792 100644 --- a/tests/SelfTest/Baselines/automake.sw.multi.approved.txt +++ b/tests/SelfTest/Baselines/automake.sw.multi.approved.txt @@ -252,6 +252,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 12a4370f47..890b490f7a 100644 --- a/tests/SelfTest/Baselines/compact.sw.approved.txt +++ b/tests/SelfTest/Baselines/compact.sw.approved.txt @@ -1748,6 +1748,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 @@ -2706,7 +2709,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: 434 | 329 passed | 85 failed | 6 skipped | 14 failed as expected -assertions: 2277 | 2096 passed | 146 failed | 35 failed as expected +test cases: 437 | 332 passed | 85 failed | 6 skipped | 14 failed as expected +assertions: 2280 | 2099 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 ee122051c7..6d3ac741cd 100644 --- a/tests/SelfTest/Baselines/compact.sw.multi.approved.txt +++ b/tests/SelfTest/Baselines/compact.sw.multi.approved.txt @@ -1741,6 +1741,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 @@ -2695,7 +2698,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: 434 | 329 passed | 85 failed | 6 skipped | 14 failed as expected -assertions: 2277 | 2096 passed | 146 failed | 35 failed as expected +test cases: 437 | 332 passed | 85 failed | 6 skipped | 14 failed as expected +assertions: 2280 | 2099 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 b01d7f9c02..2f9170c2a8 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: 434 | 343 passed | 70 failed | 7 skipped | 14 failed as expected -assertions: 2260 | 2096 passed | 129 failed | 35 failed as expected +test cases: 437 | 346 passed | 70 failed | 7 skipped | 14 failed as expected +assertions: 2263 | 2099 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 4ed468e063..3f56d0d138 100644 --- a/tests/SelfTest/Baselines/console.sw.approved.txt +++ b/tests/SelfTest/Baselines/console.sw.approved.txt @@ -11793,6 +11793,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 @@ -18949,6 +18982,6 @@ Misc.tests.cpp: Misc.tests.cpp:: PASSED: =============================================================================== -test cases: 434 | 329 passed | 85 failed | 6 skipped | 14 failed as expected -assertions: 2277 | 2096 passed | 146 failed | 35 failed as expected +test cases: 437 | 332 passed | 85 failed | 6 skipped | 14 failed as expected +assertions: 2280 | 2099 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 83c26ef20f..0480274b82 100644 --- a/tests/SelfTest/Baselines/console.sw.multi.approved.txt +++ b/tests/SelfTest/Baselines/console.sw.multi.approved.txt @@ -11786,6 +11786,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 @@ -18938,6 +18971,6 @@ Misc.tests.cpp: Misc.tests.cpp:: PASSED: =============================================================================== -test cases: 434 | 329 passed | 85 failed | 6 skipped | 14 failed as expected -assertions: 2277 | 2096 passed | 146 failed | 35 failed as expected +test cases: 437 | 332 passed | 85 failed | 6 skipped | 14 failed as expected +assertions: 2280 | 2099 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 4b89953e2a..6f1a994971 100644 --- a/tests/SelfTest/Baselines/junit.sw.approved.txt +++ b/tests/SelfTest/Baselines/junit.sw.approved.txt @@ -1,7 +1,7 @@ - + @@ -1337,6 +1337,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 16cadca461..9c23536b9a 100644 --- a/tests/SelfTest/Baselines/junit.sw.multi.approved.txt +++ b/tests/SelfTest/Baselines/junit.sw.multi.approved.txt @@ -1,6 +1,6 @@ - + @@ -1336,6 +1336,9 @@ at Misc.tests.cpp: + + + diff --git a/tests/SelfTest/Baselines/sonarqube.sw.approved.txt b/tests/SelfTest/Baselines/sonarqube.sw.approved.txt index 3e20b756ad..8d2b50ea01 100644 --- a/tests/SelfTest/Baselines/sonarqube.sw.approved.txt +++ b/tests/SelfTest/Baselines/sonarqube.sw.approved.txt @@ -905,6 +905,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 59da215334..083110fae8 100644 --- a/tests/SelfTest/Baselines/sonarqube.sw.multi.approved.txt +++ b/tests/SelfTest/Baselines/sonarqube.sw.multi.approved.txt @@ -904,6 +904,9 @@ at Condition.tests.cpp: + + + diff --git a/tests/SelfTest/Baselines/tap.sw.approved.txt b/tests/SelfTest/Baselines/tap.sw.approved.txt index 2f3ae36170..1b098e3042 100644 --- a/tests/SelfTest/Baselines/tap.sw.approved.txt +++ b/tests/SelfTest/Baselines/tap.sw.approved.txt @@ -2833,6 +2833,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 @@ -4583,5 +4589,5 @@ ok {test-number} - q3 == 23. for: 23.0 == 23.0 ok {test-number} - # xmlentitycheck ok {test-number} - -1..2289 +1..2292 diff --git a/tests/SelfTest/Baselines/tap.sw.multi.approved.txt b/tests/SelfTest/Baselines/tap.sw.multi.approved.txt index d47f70055f..872ef5791d 100644 --- a/tests/SelfTest/Baselines/tap.sw.multi.approved.txt +++ b/tests/SelfTest/Baselines/tap.sw.multi.approved.txt @@ -2826,6 +2826,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 @@ -4572,5 +4578,5 @@ ok {test-number} - q3 == 23. for: 23.0 == 23.0 ok {test-number} - # xmlentitycheck ok {test-number} - -1..2289 +1..2292 diff --git a/tests/SelfTest/Baselines/teamcity.sw.approved.txt b/tests/SelfTest/Baselines/teamcity.sw.approved.txt index 8ea9af1b5f..3c0a77df6f 100644 --- a/tests/SelfTest/Baselines/teamcity.sw.approved.txt +++ b/tests/SelfTest/Baselines/teamcity.sw.approved.txt @@ -627,6 +627,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 64282871b5..e63200a7c0 100644 --- a/tests/SelfTest/Baselines/teamcity.sw.multi.approved.txt +++ b/tests/SelfTest/Baselines/teamcity.sw.multi.approved.txt @@ -627,6 +627,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 2d21892690..67777b2f4a 100644 --- a/tests/SelfTest/Baselines/xml.sw.approved.txt +++ b/tests/SelfTest/Baselines/xml.sw.approved.txt @@ -13710,6 +13710,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 + + + + @@ -21894,6 +21927,6 @@ b1! - - + + diff --git a/tests/SelfTest/Baselines/xml.sw.multi.approved.txt b/tests/SelfTest/Baselines/xml.sw.multi.approved.txt index 5b827f1377..e4b8f19bed 100644 --- a/tests/SelfTest/Baselines/xml.sw.multi.approved.txt +++ b/tests/SelfTest/Baselines/xml.sw.multi.approved.txt @@ -13710,6 +13710,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 + + + + @@ -21893,6 +21926,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 ); +}