From 2bcf1b3db6e1a61328f1efe093d749ef40e0bbd6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Ho=C5=99e=C5=88ovsk=C3=BD?= Date: Sat, 22 Jun 2019 20:11:14 +0200 Subject: [PATCH] Remove support for test case descriptions Closes #1189 --- docs/deprecations.md | 10 ---------- docs/release-notes.md | 2 ++ examples/210-Evt-EventListeners.cpp | 2 -- include/internal/catch_interfaces_reporter.cpp | 4 ---- include/internal/catch_test_case_info.cpp | 14 +++++--------- include/internal/catch_test_case_info.h | 2 -- include/reporters/catch_reporter_xml.cpp | 4 ---- 7 files changed, 7 insertions(+), 31 deletions(-) diff --git a/docs/deprecations.md b/docs/deprecations.md index 8dbb3956..2cf77279 100644 --- a/docs/deprecations.md +++ b/docs/deprecations.md @@ -11,16 +11,6 @@ at least the next major release. ## Deprecations -### Secondary description amongst tags - -Currently, the tags part of `TEST_CASE` (and others) macro can also -contain text that is not part of tags. This text is then separated into -a "description" of the test case, but the description is then never used -apart from writing it out for `--list-tests -v high`. - -Because it isn't actually used nor documented, and brings complications -to Catch2's internals, description support will be removed. - ### SourceLineInfo::empty() There should be no reason to ever have an empty `SourceLineInfo`, so the diff --git a/docs/release-notes.md b/docs/release-notes.md index 08c8a710..8be1bbd5 100644 --- a/docs/release-notes.md +++ b/docs/release-notes.md @@ -40,6 +40,8 @@ * `--list*` commands are now piped through the reporters * The top-level reporter interface provides default implementation that works just as the old one * XmlReporter outputs a machine-parseable XML +* `TEST_CASE` description support has been removed + * If the second argument has text outside tags, the text will be ignored. ### Fixes * The `INFO` macro no longer contains superfluous semicolon (#1456) diff --git a/examples/210-Evt-EventListeners.cpp b/examples/210-Evt-EventListeners.cpp index 2d5fdb28..c4f80903 100644 --- a/examples/210-Evt-EventListeners.cpp +++ b/examples/210-Evt-EventListeners.cpp @@ -139,7 +139,6 @@ void print( std::ostream& os, int const level, std::string const& title, Catch:: // // std::string name; // std::string className; -// std::string description; // std::vector tags; // std::vector lcaseTags; // SourceLineInfo lineInfo; @@ -155,7 +154,6 @@ void print( std::ostream& os, int const level, std::string const& title, Catch:: << ws(level+1) << "- tagsAsString(): '" << info.tagsAsString() << "'\n" << ws(level+1) << "- name: '" << info.name << "'\n" << ws(level+1) << "- className: '" << info.className << "'\n" - << ws(level+1) << "- description: '" << info.description << "'\n" << ws(level+1) << "- tags: " << info.tags << "\n" << ws(level+1) << "- lcaseTags: " << info.lcaseTags << "\n"; print( os, level+1 , "- lineInfo", info.lineInfo ); diff --git a/include/internal/catch_interfaces_reporter.cpp b/include/internal/catch_interfaces_reporter.cpp index 664dd3eb..e3dc6a46 100644 --- a/include/internal/catch_interfaces_reporter.cpp +++ b/include/internal/catch_interfaces_reporter.cpp @@ -157,10 +157,6 @@ namespace Catch { Catch::cout() << Column(testCaseInfo.name).initialIndent(2).indent(4) << '\n'; if (config.verbosity() >= Verbosity::High) { Catch::cout() << Column(Catch::Detail::stringify(testCaseInfo.lineInfo)).indent(4) << std::endl; - std::string description = testCaseInfo.description; - if (description.empty()) - description = "(NO DESCRIPTION)"; - Catch::cout() << Column(description).indent(4) << std::endl; } if (!testCaseInfo.tags.empty() && config.verbosity() > Verbosity::Quiet) { Catch::cout() << Column(testCaseInfo.tagsAsString()).indent(6) << '\n'; diff --git a/include/internal/catch_test_case_info.cpp b/include/internal/catch_test_case_info.cpp index 685ee30f..f9c22c81 100644 --- a/include/internal/catch_test_case_info.cpp +++ b/include/internal/catch_test_case_info.cpp @@ -57,16 +57,14 @@ namespace Catch { // Parse out tags std::vector tags; - std::string desc, tag; + std::string tag; bool inTag = false; for (char c : nameAndTags.tags) { if( !inTag ) { - if( c == '[' ) + if (c == '[') { inTag = true; - else - desc += c; - } - else { + } + } else { if( c == ']' ) { TestCaseInfo::SpecialProperties prop = parseSpecialTag( tag ); if( ( prop & TestCaseInfo::IsHidden ) != 0 ) @@ -92,7 +90,7 @@ namespace Catch { tags.push_back( "." ); } - TestCaseInfo info( static_cast(nameAndTags.name), _className, desc, tags, _lineInfo ); + TestCaseInfo info( static_cast(nameAndTags.name), _className, tags, _lineInfo ); return TestCase( _testCase, std::move(info) ); } @@ -111,12 +109,10 @@ namespace Catch { TestCaseInfo::TestCaseInfo( std::string const& _name, std::string const& _className, - std::string const& _description, std::vector const& _tags, SourceLineInfo const& _lineInfo ) : name( _name ), className( _className ), - description( _description ), lineInfo( _lineInfo ), properties( None ) { diff --git a/include/internal/catch_test_case_info.h b/include/internal/catch_test_case_info.h index 809c974f..1ade26fc 100644 --- a/include/internal/catch_test_case_info.h +++ b/include/internal/catch_test_case_info.h @@ -37,7 +37,6 @@ namespace Catch { TestCaseInfo( std::string const& _name, std::string const& _className, - std::string const& _description, std::vector const& _tags, SourceLineInfo const& _lineInfo ); @@ -52,7 +51,6 @@ namespace Catch { std::string name; std::string className; - std::string description; std::vector tags; std::vector lcaseTags; SourceLineInfo lineInfo; diff --git a/include/reporters/catch_reporter_xml.cpp b/include/reporters/catch_reporter_xml.cpp index 8e89eb82..186ce7da 100644 --- a/include/reporters/catch_reporter_xml.cpp +++ b/include/reporters/catch_reporter_xml.cpp @@ -73,7 +73,6 @@ namespace Catch { StreamingReporterBase::testCaseStarting(testInfo); m_xml.startElement( "TestCase" ) .writeAttribute( "name", trim( testInfo.name ) ) - .writeAttribute( "description", testInfo.description ) .writeAttribute( "tags", testInfo.tagsAsString() ); writeSourceInfo( testInfo.lineInfo ); @@ -289,9 +288,6 @@ namespace Catch { m_xml.startElement("ClassName", XmlFormatting::Indent) .writeText(testInfo.className, XmlFormatting::None) .endElement(XmlFormatting::Newline); - m_xml.startElement("Description", XmlFormatting::Indent) - .writeText(testInfo.description, XmlFormatting::None) - .endElement(XmlFormatting::Newline); m_xml.startElement("Tags", XmlFormatting::Indent) .writeText(testInfo.tagsAsString(), XmlFormatting::None) .endElement(XmlFormatting::Newline);