From df90ea39e1c04318d365d180f7a344e601188d70 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 7abc684d..cf8d8889 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 c6fbbcfe..f013ccb0 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 9a6f177b..34cbeca7 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 12a4370f..890b490f 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 ee122051..6d3ac741 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 b01d7f9c..2f9170c2 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 4ed468e0..3f56d0d1 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 83c26ef2..0480274b 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 4b89953e..6f1a9949 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 16cadca4..9c23536b 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 3e20b756..8d2b50ea 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 59da2153..083110fa 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 2f3ae361..1b098e30 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 d47f7005..872ef579 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 8ea9af1b..3c0a77df 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 64282871..e63200a7 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 2d218926..67777b2f 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 5b827f13..e4b8f19b 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 3f7e1581..f2a5f3fa 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 ); +}