Read-only mirrors. Development, issues and pull requests are on GitHub.

summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorMartin Hořeňovský2019-11-16 21:53:32 +0100
committerMartin Hořeňovský2019-11-16 21:53:32 +0100
commitc9067b2253bae5d40b08e755cd4532a63debe81b (patch)
tree623b6c7962bdbfe1e5bf838bf2dc2991cfa6dd40
parentd36c15c3caf96c2e751f4ad83a386c1fd047c2f6 (diff)
downloadcatch3-c9067b2253bae5d40b08e755cd4532a63debe81b.tar.gz
Refactor SectionInfo constructors
-rw-r--r--include/internal/catch_section_info.cpp19
-rw-r--r--include/internal/catch_section_info.h13
-rw-r--r--projects/CMakeLists.txt1
-rw-r--r--projects/SelfTest/Baselines/compact.sw.approved.txt1
-rw-r--r--projects/SelfTest/Baselines/console.std.approved.txt4
-rw-r--r--projects/SelfTest/Baselines/console.sw.approved.txt13
-rw-r--r--projects/SelfTest/Baselines/console.swa4.approved.txt13
-rw-r--r--projects/SelfTest/Baselines/junit.sw.approved.txt3
-rw-r--r--projects/SelfTest/Baselines/sonarqube.sw.approved.txt1
-rw-r--r--projects/SelfTest/Baselines/xml.sw.approved.txt10
-rw-r--r--projects/SelfTest/UsageTests/Compilation.tests.cpp6
11 files changed, 47 insertions, 37 deletions
diff --git a/include/internal/catch_section_info.cpp b/include/internal/catch_section_info.cpp
deleted file mode 100644
index 89714e35..00000000
--- a/include/internal/catch_section_info.cpp
+++ /dev/null
@@ -1,19 +0,0 @@
-/*
- * Created by Martin on 01/08/2017.
- *
- * Distributed under the Boost Software License, Version 1.0. (See accompanying
- * file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
- */
-
-#include "catch_section_info.h"
-
-namespace Catch {
-
- SectionInfo::SectionInfo
- ( SourceLineInfo const& _lineInfo,
- std::string const& _name )
- : name( _name ),
- lineInfo( _lineInfo )
- {}
-
-} // end namespace Catch
diff --git a/include/internal/catch_section_info.h b/include/internal/catch_section_info.h
index 7215c744..50a31aeb 100644
--- a/include/internal/catch_section_info.h
+++ b/include/internal/catch_section_info.h
@@ -17,17 +17,14 @@
namespace Catch {
struct SectionInfo {
- SectionInfo
- ( SourceLineInfo const& _lineInfo,
- std::string const& _name );
-
// The last argument is ignored, so that people can write
// SECTION("ShortName", "Proper description that is long") and
// still use the `-c` flag comfortably.
- SectionInfo
- ( SourceLineInfo const& _lineInfo,
- std::string const& _name,
- const char* const ) : SectionInfo( _lineInfo, _name ) {}
+ SectionInfo( SourceLineInfo const& _lineInfo, std::string _name,
+ const char* const = nullptr ):
+ name(std::move(_name)),
+ lineInfo(_lineInfo)
+ {}
std::string name;
SourceLineInfo lineInfo;
diff --git a/projects/CMakeLists.txt b/projects/CMakeLists.txt
index 30536ebf..f36de496 100644
--- a/projects/CMakeLists.txt
+++ b/projects/CMakeLists.txt
@@ -244,7 +244,6 @@ set(IMPL_SOURCES
${HEADER_DIR}/internal/catch_result_type.cpp
${HEADER_DIR}/internal/catch_run_context.cpp
${HEADER_DIR}/internal/catch_section.cpp
- ${HEADER_DIR}/internal/catch_section_info.cpp
${HEADER_DIR}/internal/catch_session.cpp
${HEADER_DIR}/internal/catch_singletons.cpp
${HEADER_DIR}/internal/catch_startup_exception_registry.cpp
diff --git a/projects/SelfTest/Baselines/compact.sw.approved.txt b/projects/SelfTest/Baselines/compact.sw.approved.txt
index 6853df4e..0b2436ce 100644
--- a/projects/SelfTest/Baselines/compact.sw.approved.txt
+++ b/projects/SelfTest/Baselines/compact.sw.approved.txt
@@ -15,6 +15,7 @@ Misc.tests.cpp:<line number>: passed:
Compilation.tests.cpp:<line number>: passed: std::memcmp(uarr, "123", sizeof(uarr)) == 0 for: 0 == 0 with 2 messages: 'uarr := "123"' and 'sarr := "456"'
Compilation.tests.cpp:<line number>: passed: std::memcmp(sarr, "456", sizeof(sarr)) == 0 for: 0 == 0 with 2 messages: 'uarr := "123"' and 'sarr := "456"'
Compilation.tests.cpp:<line number>: passed:
+Compilation.tests.cpp:<line number>: passed:
Compilation.tests.cpp:<line number>: passed: h1 == h2 for: [1403 helper] == [1403 helper]
Message.tests.cpp:<line number>: warning: '
This info message starts with a linebreak' with 1 message: '
diff --git a/projects/SelfTest/Baselines/console.std.approved.txt b/projects/SelfTest/Baselines/console.std.approved.txt
index a6338bde..3ae07e23 100644
--- a/projects/SelfTest/Baselines/console.std.approved.txt
+++ b/projects/SelfTest/Baselines/console.std.approved.txt
@@ -1380,6 +1380,6 @@ due to unexpected exception with message:
Why would you throw a std::string?
===============================================================================
-test cases: 304 | 230 passed | 70 failed | 4 failed as expected
-assertions: 1653 | 1501 passed | 131 failed | 21 failed as expected
+test cases: 305 | 231 passed | 70 failed | 4 failed as expected
+assertions: 1654 | 1502 passed | 131 failed | 21 failed as expected
diff --git a/projects/SelfTest/Baselines/console.sw.approved.txt b/projects/SelfTest/Baselines/console.sw.approved.txt
index e8259948..42f94b55 100644
--- a/projects/SelfTest/Baselines/console.sw.approved.txt
+++ b/projects/SelfTest/Baselines/console.sw.approved.txt
@@ -140,6 +140,15 @@ Compilation.tests.cpp:<line number>
Compilation.tests.cpp:<line number>: PASSED:
-------------------------------------------------------------------------------
+#1319: Sections can have description (even if it is not saved
+ SectionName
+-------------------------------------------------------------------------------
+Compilation.tests.cpp:<line number>
+...............................................................................
+
+Compilation.tests.cpp:<line number>: PASSED:
+
+-------------------------------------------------------------------------------
#1403
-------------------------------------------------------------------------------
Compilation.tests.cpp:<line number>
@@ -13207,6 +13216,6 @@ Misc.tests.cpp:<line number>
Misc.tests.cpp:<line number>: PASSED:
===============================================================================
-test cases: 304 | 214 passed | 86 failed | 4 failed as expected
-assertions: 1670 | 1501 passed | 148 failed | 21 failed as expected
+test cases: 305 | 215 passed | 86 failed | 4 failed as expected
+assertions: 1671 | 1502 passed | 148 failed | 21 failed as expected
diff --git a/projects/SelfTest/Baselines/console.swa4.approved.txt b/projects/SelfTest/Baselines/console.swa4.approved.txt
index 0c1ab7b7..72d87375 100644
--- a/projects/SelfTest/Baselines/console.swa4.approved.txt
+++ b/projects/SelfTest/Baselines/console.swa4.approved.txt
@@ -140,6 +140,15 @@ Compilation.tests.cpp:<line number>
Compilation.tests.cpp:<line number>: PASSED:
-------------------------------------------------------------------------------
+#1319: Sections can have description (even if it is not saved
+ SectionName
+-------------------------------------------------------------------------------
+Compilation.tests.cpp:<line number>
+...............................................................................
+
+Compilation.tests.cpp:<line number>: PASSED:
+
+-------------------------------------------------------------------------------
#1403
-------------------------------------------------------------------------------
Compilation.tests.cpp:<line number>
@@ -368,6 +377,6 @@ Condition.tests.cpp:<line number>: FAILED:
CHECK( true != true )
===============================================================================
-test cases: 19 | 14 passed | 3 failed | 2 failed as expected
-assertions: 42 | 35 passed | 4 failed | 3 failed as expected
+test cases: 20 | 15 passed | 3 failed | 2 failed as expected
+assertions: 43 | 36 passed | 4 failed | 3 failed as expected
diff --git a/projects/SelfTest/Baselines/junit.sw.approved.txt b/projects/SelfTest/Baselines/junit.sw.approved.txt
index 424e073c..9a04960f 100644
--- a/projects/SelfTest/Baselines/junit.sw.approved.txt
+++ b/projects/SelfTest/Baselines/junit.sw.approved.txt
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<testsuitesloose text artifact
>
- <testsuite name="<exe-name>" errors="17" failures="132" tests="1671" hostname="tbd" time="{duration}" timestamp="{iso8601-timestamp}">
+ <testsuite name="<exe-name>" errors="17" failures="132" tests="1672" hostname="tbd" time="{duration}" timestamp="{iso8601-timestamp}">
<properties>
<property name="filters" value="~[!nonportable]~[!benchmark]~[approvals] *"/>
<property name="random-seed" value="1"/>
@@ -14,6 +14,7 @@
<testcase classname="<exe-name>.global" name="#1175 - Hidden Test" time="{duration}"/>
<testcase classname="<exe-name>.global" name="#1238" time="{duration}"/>
<testcase classname="<exe-name>.(Fixture_1245&lt;int, int>)" name="#1245" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="#1319: Sections can have description (even if it is not saved/SectionName" time="{duration}"/>
<testcase classname="<exe-name>.global" name="#1403" time="{duration}"/>
<testcase classname="<exe-name>.global" name="#1455 - INFO and WARN can start with a linebreak" time="{duration}"/>
<testcase classname="<exe-name>.global" name="#1514: stderr/stdout is not captured in tests aborted by an exception" time="{duration}">
diff --git a/projects/SelfTest/Baselines/sonarqube.sw.approved.txt b/projects/SelfTest/Baselines/sonarqube.sw.approved.txt
index 0bd44a18..fb91039a 100644
--- a/projects/SelfTest/Baselines/sonarqube.sw.approved.txt
+++ b/projects/SelfTest/Baselines/sonarqube.sw.approved.txt
@@ -358,6 +358,7 @@ Class.tests.cpp:<line number>
<testCase name="#1147" duration="{duration}"/>
<testCase name="#1238" duration="{duration}"/>
<testCase name="#1245" duration="{duration}"/>
+ <testCase name="#1319: Sections can have description (even if it is not saved/SectionName" duration="{duration}"/>
<testCase name="#1403" duration="{duration}"/>
<testCase name="#1548" duration="{duration}"/>
<testCase name="#809" duration="{duration}"/>
diff --git a/projects/SelfTest/Baselines/xml.sw.approved.txt b/projects/SelfTest/Baselines/xml.sw.approved.txt
index d57f0b86..2ceb9fe9 100644
--- a/projects/SelfTest/Baselines/xml.sw.approved.txt
+++ b/projects/SelfTest/Baselines/xml.sw.approved.txt
@@ -150,6 +150,12 @@
<TestCase name="#1245" tags="[compilation]" filename="projects/<exe-name>/UsageTests/Compilation.tests.cpp" >
<OverallResult success="true"/>
</TestCase>
+ <TestCase name="#1319: Sections can have description (even if it is not saved" tags="[compilation]" filename="projects/<exe-name>/UsageTests/Compilation.tests.cpp" >
+ <Section name="SectionName" filename="projects/<exe-name>/UsageTests/Compilation.tests.cpp" >
+ <OverallResults successes="1" failures="0" expectedFailures="0"/>
+ </Section>
+ <OverallResult success="true"/>
+ </TestCase>
<TestCase name="#1403" tags="[compilation]" filename="projects/<exe-name>/UsageTests/Compilation.tests.cpp" >
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Compilation.tests.cpp" >
<Original>
@@ -15790,7 +15796,7 @@ loose text artifact
</Section>
<OverallResult success="true"/>
</TestCase>
- <OverallResults successes="1501" failures="149" expectedFailures="21"/>
+ <OverallResults successes="1502" failures="149" expectedFailures="21"/>
</Group>
- <OverallResults successes="1501" failures="148" expectedFailures="21"/>
+ <OverallResults successes="1502" failures="148" expectedFailures="21"/>
</Catch>
diff --git a/projects/SelfTest/UsageTests/Compilation.tests.cpp b/projects/SelfTest/UsageTests/Compilation.tests.cpp
index 11d136a4..aaba69c4 100644
--- a/projects/SelfTest/UsageTests/Compilation.tests.cpp
+++ b/projects/SelfTest/UsageTests/Compilation.tests.cpp
@@ -218,6 +218,12 @@ namespace { namespace CompilationTests {
REQUIRE( y.v == 0 );
REQUIRE( 0 == y.v );
}
+
+ TEST_CASE("#1319: Sections can have description (even if it is not saved", "[compilation]") {
+ SECTION("SectionName", "This is a long form section description") {
+ SUCCEED();
+ }
+ }
}} // namespace CompilationTests