From 3afd077b554779607ed8ccbf34c365eb73ba460d Mon Sep 17 00:00:00 2001 From: Alex Glyde Date: Mon, 6 Mar 2017 10:35:03 -0500 Subject: [PATCH 01/32] teamcity reporter should time durations explicitly --- include/reporters/catch_reporter_teamcity.hpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/include/reporters/catch_reporter_teamcity.hpp b/include/reporters/catch_reporter_teamcity.hpp index 1e633f1d..12403f07 100644 --- a/include/reporters/catch_reporter_teamcity.hpp +++ b/include/reporters/catch_reporter_teamcity.hpp @@ -148,6 +148,7 @@ namespace Catch { } virtual void testCaseStarting( TestCaseInfo const& testInfo ) CATCH_OVERRIDE { + testTimer.start(); StreamingReporterBase::testCaseStarting( testInfo ); stream << "##teamcity[testStarted name='" << escape( testInfo.name ) << "']\n"; @@ -164,7 +165,8 @@ namespace Catch { << escape( testCaseStats.testInfo.name ) << "' out='" << escape( testCaseStats.stdErr ) << "']\n"; stream << "##teamcity[testFinished name='" - << escape( testCaseStats.testInfo.name ) << "']\n"; + << escape( testCaseStats.testInfo.name ) << "' duration='" + << testTimer.getElapsedMilliseconds() << "']\n"; } private: @@ -203,7 +205,7 @@ namespace Catch { } private: bool m_headerPrintedForThisSection; - + Timer testTimer; }; #ifdef CATCH_IMPL From d8f45cd5f14204e1bd1a922d17f2ab1cd005a34a Mon Sep 17 00:00:00 2001 From: Alex Glyde Date: Mon, 6 Mar 2017 10:55:00 -0500 Subject: [PATCH 02/32] changing tabs to spaces --- include/reporters/catch_reporter_teamcity.hpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/include/reporters/catch_reporter_teamcity.hpp b/include/reporters/catch_reporter_teamcity.hpp index 12403f07..547539a0 100644 --- a/include/reporters/catch_reporter_teamcity.hpp +++ b/include/reporters/catch_reporter_teamcity.hpp @@ -148,7 +148,7 @@ namespace Catch { } virtual void testCaseStarting( TestCaseInfo const& testInfo ) CATCH_OVERRIDE { - testTimer.start(); + testTimer.start(); StreamingReporterBase::testCaseStarting( testInfo ); stream << "##teamcity[testStarted name='" << escape( testInfo.name ) << "']\n"; @@ -165,8 +165,8 @@ namespace Catch { << escape( testCaseStats.testInfo.name ) << "' out='" << escape( testCaseStats.stdErr ) << "']\n"; stream << "##teamcity[testFinished name='" - << escape( testCaseStats.testInfo.name ) << "' duration='" - << testTimer.getElapsedMilliseconds() << "']\n"; + << escape( testCaseStats.testInfo.name ) << "' duration='" + << testTimer.getElapsedMilliseconds() << "']\n"; } private: @@ -205,7 +205,7 @@ namespace Catch { } private: bool m_headerPrintedForThisSection; - Timer testTimer; + Timer testTimer; }; #ifdef CATCH_IMPL From e4694f58da1b1c1ae84cf213ceb5bdc6a38489e9 Mon Sep 17 00:00:00 2001 From: Phil Nash Date: Tue, 25 Apr 2017 14:15:59 +0000 Subject: [PATCH 03/32] Removed errant uses of uint64_t fixes #894 --- include/internal/catch_timer.hpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/include/internal/catch_timer.hpp b/include/internal/catch_timer.hpp index dfb7811f..ed9e9a94 100644 --- a/include/internal/catch_timer.hpp +++ b/include/internal/catch_timer.hpp @@ -28,21 +28,21 @@ namespace Catch { namespace { #ifdef CATCH_PLATFORM_WINDOWS - uint64_t getCurrentTicks() { - static uint64_t hz=0, hzo=0; + UInt64 getCurrentTicks() { + static UInt64 hz=0, hzo=0; if (!hz) { QueryPerformanceFrequency( reinterpret_cast( &hz ) ); QueryPerformanceCounter( reinterpret_cast( &hzo ) ); } - uint64_t t; + UInt64 t; QueryPerformanceCounter( reinterpret_cast( &t ) ); return ((t-hzo)*1000000)/hz; } #else - uint64_t getCurrentTicks() { + UInt64 getCurrentTicks() { timeval t; gettimeofday(&t,CATCH_NULL); - return static_cast( t.tv_sec ) * 1000000ull + static_cast( t.tv_usec ); + return static_cast( t.tv_sec ) * 1000000ull + static_cast( t.tv_usec ); } #endif } From a0ada2e935324db5c951571c52c9b07307ea422f Mon Sep 17 00:00:00 2001 From: Phil Nash Date: Tue, 25 Apr 2017 14:23:06 +0000 Subject: [PATCH 04/32] v1.9.3 --- README.md | 2 +- docs/release-notes.md | 5 +++++ include/internal/catch_version.hpp | 2 +- single_include/catch.hpp | 16 ++++++++-------- 4 files changed, 15 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index f4f30fd3..3f93d794 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ [![Build Status](https://travis-ci.org/philsquared/Catch.svg?branch=master)](https://travis-ci.org/philsquared/Catch) [![Build status](https://ci.appveyor.com/api/projects/status/hrtk60hv6tw6fght/branch/master?svg=true)](https://ci.appveyor.com/project/philsquared/catch/branch/master) -The latest, single header, version can be downloaded directly using this link +The latest, single header, version can be downloaded directly using this link ## What's the Catch? diff --git a/docs/release-notes.md b/docs/release-notes.md index 99445eb5..8b12188b 100644 --- a/docs/release-notes.md +++ b/docs/release-notes.md @@ -1,3 +1,8 @@ +# 1.9.3 + +### Fixes +* Completed the fix for (lack of) uint64_t in earlier Visual Studios + # 1.9.2 ### Improvements and minor changes diff --git a/include/internal/catch_version.hpp b/include/internal/catch_version.hpp index fdf3be6e..7092f7b7 100644 --- a/include/internal/catch_version.hpp +++ b/include/internal/catch_version.hpp @@ -38,7 +38,7 @@ namespace Catch { } inline Version libraryVersion() { - static Version version( 1, 9, 2, "", 0 ); + static Version version( 1, 9, 3, "", 0 ); return version; } diff --git a/single_include/catch.hpp b/single_include/catch.hpp index f0d5e756..599eee90 100644 --- a/single_include/catch.hpp +++ b/single_include/catch.hpp @@ -1,6 +1,6 @@ /* - * Catch v1.9.2 - * Generated: 2017-04-25 10:41:53.040184 + * Catch v1.9.3 + * Generated: 2017-04-25 14:16:29.434734 * ---------------------------------------------------------- * This file has been merged from multiple headers. Please don't edit it directly * Copyright (c) 2012 Two Blue Cubes Ltd. All rights reserved. @@ -8282,7 +8282,7 @@ namespace Catch { } inline Version libraryVersion() { - static Version version( 1, 9, 2, "", 0 ); + static Version version( 1, 9, 3, "", 0 ); return version; } @@ -8468,21 +8468,21 @@ namespace Catch { namespace { #ifdef CATCH_PLATFORM_WINDOWS - uint64_t getCurrentTicks() { - static uint64_t hz=0, hzo=0; + UInt64 getCurrentTicks() { + static UInt64 hz=0, hzo=0; if (!hz) { QueryPerformanceFrequency( reinterpret_cast( &hz ) ); QueryPerformanceCounter( reinterpret_cast( &hzo ) ); } - uint64_t t; + UInt64 t; QueryPerformanceCounter( reinterpret_cast( &t ) ); return ((t-hzo)*1000000)/hz; } #else - uint64_t getCurrentTicks() { + UInt64 getCurrentTicks() { timeval t; gettimeofday(&t,CATCH_NULL); - return static_cast( t.tv_sec ) * 1000000ull + static_cast( t.tv_usec ); + return static_cast( t.tv_sec ) * 1000000ull + static_cast( t.tv_usec ); } #endif } From 6e0fa4be682ccc142da5ed7ddaadb6e42ea936c5 Mon Sep 17 00:00:00 2001 From: JayAndCatchFire Date: Wed, 26 Apr 2017 15:56:24 -0500 Subject: [PATCH 05/32] Update opensource-users.md Fixed broken link to LICENSE --- docs/opensource-users.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/opensource-users.md b/docs/opensource-users.md index 05a9a193..d4a96902 100644 --- a/docs/opensource-users.md +++ b/docs/opensource-users.md @@ -1,6 +1,6 @@ # Open Source projects using Catch -Catch is great for open source. With it's [liberal license](../LICENSE_1_0.txt) and single-header, dependency-free, distribution +Catch is great for open source. With it's [liberal license](../LICENSE.txt) and single-header, dependency-free, distribution it's easy to just drop the header into your project and start writing tests - what's not to like? As a result Catch is now being used in many Open Source projects, including some quite well known ones. From 5ffc8a84cda91b5da037a923480236450f7f4586 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Ho=C5=99e=C5=88ovsk=C3=BD?= Date: Fri, 28 Apr 2017 18:30:04 +0200 Subject: [PATCH 06/32] Fix order of arguments in CATCH_FAIL and nonvariadic INTERNAL_CATCH_MSG Fixes #896 --- include/catch.hpp | 2 +- include/internal/catch_capture.hpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/include/catch.hpp b/include/catch.hpp index bf0d72d6..f258f8a2 100644 --- a/include/catch.hpp +++ b/include/catch.hpp @@ -136,7 +136,7 @@ LeakDetector leakDetector; #define CATCH_METHOD_AS_TEST_CASE( method, ... ) INTERNAL_CATCH_METHOD_AS_TEST_CASE( method, __VA_ARGS__ ) #define CATCH_REGISTER_TEST_CASE( Function, ... ) INTERNAL_CATCH_REGISTER_TESTCASE( Function, __VA_ARGS__ ) #define CATCH_SECTION( ... ) INTERNAL_CATCH_SECTION( __VA_ARGS__ ) - #define CATCH_FAIL( ... ) INTERNAL_CATCH_MSG( Catch::ResultWas::ExplicitFailure, Catch::ResultDisposition::Normal, "CATCH_FAIL", __VA_ARGS__ ) + #define CATCH_FAIL( ... ) INTERNAL_CATCH_MSG( "CATCH_FAIL", Catch::ResultWas::ExplicitFailure, Catch::ResultDisposition::Normal, __VA_ARGS ) #define CATCH_FAIL_CHECK( ... ) INTERNAL_CATCH_MSG( "CATCH_FAIL_CHECK", Catch::ResultWas::ExplicitFailure, Catch::ResultDisposition::ContinueOnFailure, __VA_ARGS__ ) #define CATCH_SUCCEED( ... ) INTERNAL_CATCH_MSG( "CATCH_SUCCEED", Catch::ResultWas::Ok, Catch::ResultDisposition::ContinueOnFailure, __VA_ARGS__ ) #else diff --git a/include/internal/catch_capture.hpp b/include/internal/catch_capture.hpp index 58993718..928b06c9 100644 --- a/include/internal/catch_capture.hpp +++ b/include/internal/catch_capture.hpp @@ -152,7 +152,7 @@ INTERNAL_CATCH_REACT( __catchResult ) \ } while( Catch::alwaysFalse() ) #else - #define INTERNAL_CATCH_MSG( messageType, resultDisposition, macroName, log ) \ + #define INTERNAL_CATCH_MSG( macroName, messageType, resultDisposition, log ) \ do { \ Catch::ResultBuilder __catchResult( macroName, CATCH_INTERNAL_LINEINFO, "", resultDisposition ); \ __catchResult << log + ::Catch::StreamEndStop(); \ From 9ceae8f51fac4ffcfb70bec651af2f1a2a62d968 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Ho=C5=99e=C5=88ovsk=C3=BD?= Date: Fri, 28 Apr 2017 20:27:10 +0200 Subject: [PATCH 07/32] CMake binaries are now conditionally enabled Defining NO_SELFTEST=1 when cmake configuration is being done now turns off SelfTest and Benchmark executables. This is for projects that consume Catch using ExternalProject_Add and don't want to build our selftest binaries for their unit test suite. Closes #897 --- CMakeLists.txt | 43 +++++++++++++++++++++++++------------------ 1 file changed, 25 insertions(+), 18 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 95bdf68e..8d39bdb8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -245,28 +245,35 @@ SOURCE_GROUP("Benchmarks" FILES ${BENCH_SOURCES}) # configure the executable include_directories(${HEADER_DIR}) -add_executable(SelfTest ${TEST_SOURCES} ${IMPL_SOURCES} ${HEADERS}) -add_executable(Benchmark ${BENCH_SOURCES} ${HEADERS}) -# Add desired warnings -if ( CMAKE_CXX_COMPILER_ID MATCHES "Clang|AppleClang|GNU" ) - target_compile_options( SelfTest PRIVATE -Wall -Wextra ) - target_compile_options( Benchmark PRIVATE -Wall -Wextra ) -endif() -if ( CMAKE_CXX_COMPILER_ID MATCHES "MSVC" ) - target_compile_options( SelfTest PRIVATE /W4 /w44265 /WX ) - target_compile_options( Benchmark PRIVATE /W4 ) -endif() +# Projects consuming Catch via ExternalProject_Add might want to use install step +# without building all of our selftests. +if (NOT NO_SELFTEST) + add_executable(SelfTest ${TEST_SOURCES} ${IMPL_SOURCES} ${HEADERS}) + add_executable(Benchmark ${BENCH_SOURCES} ${HEADERS}) + + # Add desired warnings + if ( CMAKE_CXX_COMPILER_ID MATCHES "Clang|AppleClang|GNU" ) + target_compile_options( SelfTest PRIVATE -Wall -Wextra ) + target_compile_options( Benchmark PRIVATE -Wall -Wextra ) + endif() + if ( CMAKE_CXX_COMPILER_ID MATCHES "MSVC" ) + target_compile_options( SelfTest PRIVATE /W4 /w44265 /WX ) + target_compile_options( Benchmark PRIVATE /W4 ) + endif() -# configure unit tests via CTest -enable_testing() -add_test(NAME RunTests COMMAND SelfTest) + # configure unit tests via CTest + enable_testing() + add_test(NAME RunTests COMMAND SelfTest) -add_test(NAME ListTests COMMAND SelfTest --list-tests) -set_tests_properties(ListTests PROPERTIES PASS_REGULAR_EXPRESSION "[0-9]+ test cases") + add_test(NAME ListTests COMMAND SelfTest --list-tests) + set_tests_properties(ListTests PROPERTIES PASS_REGULAR_EXPRESSION "[0-9]+ test cases") + + add_test(NAME ListTags COMMAND SelfTest --list-tags) + set_tests_properties(ListTags PROPERTIES PASS_REGULAR_EXPRESSION "[0-9]+ tags") + +endif() # !NO_SELFTEST -add_test(NAME ListTags COMMAND SelfTest --list-tags) -set_tests_properties(ListTags PROPERTIES PASS_REGULAR_EXPRESSION "[0-9]+ tags") install(DIRECTORY "single_include/" DESTINATION "include/catch") From b8194322718a1f61d3309023052c87090fa6bae3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Ho=C5=99e=C5=88ovsk=C3=BD?= Date: Sat, 29 Apr 2017 17:50:03 +0200 Subject: [PATCH 08/32] Don't clear out all messages upon printing an assertion. Previously, this would not print out any messages for the last CHECK ```cpp TEST_CASE("Foo") { INFO("Test case start"); for (int i = 0; i < 2; ++i) { INFO("The number is " << i); CHECK(i == 0); } CHECK(false); } ``` now it does. --- include/internal/catch_run_context.hpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/include/internal/catch_run_context.hpp b/include/internal/catch_run_context.hpp index e6dbd38c..f9d3607a 100644 --- a/include/internal/catch_run_context.hpp +++ b/include/internal/catch_run_context.hpp @@ -145,8 +145,9 @@ namespace Catch { m_totals.assertions.failed++; } - if( m_reporter->assertionEnded( AssertionStats( result, m_messages, m_totals ) ) ) - m_messages.clear(); + // We have no use for the return value (whether messages should be cleared), because messages were made scoped + // and should be let to clear themselves out. + static_cast(m_reporter->assertionEnded(AssertionStats(result, m_messages, m_totals))); // Reset working state m_lastAssertionInfo = AssertionInfo( std::string(), m_lastAssertionInfo.lineInfo, "{Unknown expression after the reported line}" , m_lastAssertionInfo.resultDisposition ); From a3ceb8f007266d9bb3fbfa5dc1b77108adbbd781 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Ho=C5=99e=C5=88ovsk=C3=BD?= Date: Sat, 29 Apr 2017 17:52:12 +0200 Subject: [PATCH 09/32] Approval tests now can deal with different expansions of errno --- scripts/approvalTests.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/scripts/approvalTests.py b/scripts/approvalTests.py index b1b1d65d..0b0d036c 100755 --- a/scripts/approvalTests.py +++ b/scripts/approvalTests.py @@ -36,6 +36,13 @@ exeNameParser = re.compile(r''' # This is a hack until something more reasonable is figured out specialCaseParser = re.compile(r'file\((\d+)\)') +# errno macro expands into various names depending on platform, so we need to fix them up as well +errnoParser = re.compile(r''' + \(\*__errno_location\ \(\)\) + | + \(\*__error\(\)\) +''', re.VERBOSE) + if len(sys.argv) == 2: cmdPath = sys.argv[1] else: @@ -90,6 +97,7 @@ def filterLine(line): line = durationsParser.sub(' time="{duration}"', line) line = timestampsParser.sub(' timestamp="{iso8601-timestamp}"', line) line = specialCaseParser.sub('file:\g<1>', line) + line = errnoParser.sub('errno', line) return line From e6414851321c5d3f62df1e2a815dd3beca6abf2a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Ho=C5=99e=C5=88ovsk=C3=BD?= Date: Sat, 29 Apr 2017 17:54:10 +0200 Subject: [PATCH 10/32] Updated approval tests --- .../Baselines/console.std.approved.txt | 4 +++- .../Baselines/console.sw.approved.txt | 14 +++++++++---- .../Baselines/console.swa4.approved.txt | 2 +- .../SelfTest/Baselines/junit.sw.approved.txt | 3 +++ .../SelfTest/Baselines/xml.sw.approved.txt | 20 ++++++++++++++++++- 5 files changed, 36 insertions(+), 7 deletions(-) diff --git a/projects/SelfTest/Baselines/console.std.approved.txt b/projects/SelfTest/Baselines/console.std.approved.txt index e6bcf41e..0ad362e9 100644 --- a/projects/SelfTest/Baselines/console.std.approved.txt +++ b/projects/SelfTest/Baselines/console.std.approved.txt @@ -368,7 +368,9 @@ MessageTests.cpp:: FAILED: CHECK( a == 0 ) with expansion: 2 == 0 -with message: +with messages: + this message may be logged later + this message should be logged and this, but later ------------------------------------------------------------------------------- diff --git a/projects/SelfTest/Baselines/console.sw.approved.txt b/projects/SelfTest/Baselines/console.sw.approved.txt index ac178f80..c1d8865a 100644 --- a/projects/SelfTest/Baselines/console.sw.approved.txt +++ b/projects/SelfTest/Baselines/console.sw.approved.txt @@ -119,7 +119,7 @@ with expansion: MiscTests.cpp:: PASSED: - REQUIRE( (*__error()) == 1 ) + REQUIRE( errno == 1 ) with expansion: 1 == 1 @@ -2717,14 +2717,17 @@ MessageTests.cpp:: FAILED: CHECK( a == 1 ) with expansion: 2 == 1 -with message: +with messages: + this message may be logged later this message should be logged MessageTests.cpp:: FAILED: CHECK( a == 0 ) with expansion: 2 == 0 -with message: +with messages: + this message may be logged later + this message should be logged and this, but later MessageTests.cpp:: @@ -2732,7 +2735,10 @@ PASSED: CHECK( a == 2 ) with expansion: 2 == 2 -with message: +with messages: + this message may be logged later + this message should be logged + and this, but later but not this ------------------------------------------------------------------------------- diff --git a/projects/SelfTest/Baselines/console.swa4.approved.txt b/projects/SelfTest/Baselines/console.swa4.approved.txt index dcabf4e0..a23a6ab7 100644 --- a/projects/SelfTest/Baselines/console.swa4.approved.txt +++ b/projects/SelfTest/Baselines/console.swa4.approved.txt @@ -119,7 +119,7 @@ with expansion: MiscTests.cpp:: PASSED: - REQUIRE( (*__error()) == 1 ) + REQUIRE( errno == 1 ) with expansion: 1 == 1 diff --git a/projects/SelfTest/Baselines/junit.sw.approved.txt b/projects/SelfTest/Baselines/junit.sw.approved.txt index 49df947e..6237fb63 100644 --- a/projects/SelfTest/Baselines/junit.sw.approved.txt +++ b/projects/SelfTest/Baselines/junit.sw.approved.txt @@ -237,10 +237,13 @@ MessageTests.cpp: +this message may be logged later this message should be logged MessageTests.cpp: +this message may be logged later +this message should be logged and this, but later MessageTests.cpp: diff --git a/projects/SelfTest/Baselines/xml.sw.approved.txt b/projects/SelfTest/Baselines/xml.sw.approved.txt index fed55cd0..83d9a421 100644 --- a/projects/SelfTest/Baselines/xml.sw.approved.txt +++ b/projects/SelfTest/Baselines/xml.sw.approved.txt @@ -128,7 +128,7 @@ - (*__error()) == 1 + errno == 1 1 == 1 @@ -2744,6 +2744,9 @@ 2 == 2 + + this message may be logged later + this message should be logged @@ -2755,6 +2758,12 @@ 2 == 1 + + this message may be logged later + + + this message should be logged + and this, but later @@ -2766,6 +2775,15 @@ 2 == 0 + + this message may be logged later + + + this message should be logged + + + and this, but later + but not this From 98e61c31dfee09337a77234443e10cf29778975a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Ho=C5=99e=C5=88ovsk=C3=BD?= Date: Sat, 29 Apr 2017 18:06:36 +0200 Subject: [PATCH 11/32] Approval tests now see different line endings as ok This is mostly to deal with WSL, where git will checkout file with CRLF, but code that uses formatted output will be writing LFs. --- scripts/approvalTests.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/approvalTests.py b/scripts/approvalTests.py index 0b0d036c..3b71be3e 100755 --- a/scripts/approvalTests.py +++ b/scripts/approvalTests.py @@ -52,9 +52,9 @@ overallResult = 0 def diffFiles(fileA, fileB): with open(fileA, 'r') as file: - aLines = file.readlines() + aLines = [line.rstrip() for line in file.readlines()] with open(fileB, 'r') as file: - bLines = file.readlines() + bLines = [line.rstrip() for line in file.readlines()] shortenedFilenameA = fileA.rsplit(os.sep, 1)[-1] shortenedFilenameB = fileB.rsplit(os.sep, 1)[-1] @@ -127,7 +127,7 @@ def approve(baseName, args): if os.path.exists(baselinesPath): diffResult = diffFiles(baselinesPath, filteredResultsPath) if diffResult: - print(''.join(diffResult)) + print('\n'.join(diffResult)) print(" \n****************************\n \033[91mResults differed") if len(diffResult) > overallResult: overallResult = len(diffResult) From 6f012f2d1d7cc3e467ba41916acd0efc570a2ebd Mon Sep 17 00:00:00 2001 From: "Benjamin R. Jack" Date: Mon, 1 May 2017 11:17:57 -0500 Subject: [PATCH 12/32] Added warning if source file cannot be found If source files are defined using relative paths, CMake will compile the tests, but this script will (sometimes) fail to find and parse the tests from the source files. I have added an explicit warning when ParseAndAddCatchTests fails to find a source file. --- contrib/ParseAndAddCatchTests.cmake | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/ParseAndAddCatchTests.cmake b/contrib/ParseAndAddCatchTests.cmake index 7fcf7169..a81de4b8 100644 --- a/contrib/ParseAndAddCatchTests.cmake +++ b/contrib/ParseAndAddCatchTests.cmake @@ -48,6 +48,7 @@ endfunction() # Worker function function(ParseFile SourceFile TestTarget) if(NOT EXISTS ${SourceFile}) + message(WARNING "Cannot find source file: ${SourceFile}") return() endif() file(STRINGS ${SourceFile} Contents NEWLINE_CONSUME) @@ -111,4 +112,4 @@ function(ParseAndAddCatchTests TestTarget) foreach(SourceFile ${SourceFiles}) ParseFile(${SourceFile} ${TestTarget}) endforeach() -endfunction() \ No newline at end of file +endfunction() From 5604ec7266e54fc38dbbe3bca1b50beef3d39fc2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Ho=C5=99e=C5=88ovsk=C3=BD?= Date: Wed, 3 May 2017 21:09:27 +0200 Subject: [PATCH 13/32] Updated toString documentation It will need another update when Catch 2 goes live. Closes #741 --- docs/tostring.md | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/docs/tostring.md b/docs/tostring.md index dbb6cb8d..b0c8d556 100644 --- a/docs/tostring.md +++ b/docs/tostring.md @@ -16,16 +16,7 @@ std::ostream& operator << ( std::ostream& os, T const& value ) { (where ```T``` is your type and ```convertMyTypeToString``` is where you'll write whatever code is necessary to make your type printable - it doesn't have to be in another function). -You should put this function in the same namespace as your type. - -Alternatively you may prefer to write it as a member function: - -``` -std::ostream& T::operator << ( std::ostream& os ) const { - os << convertMyTypeToString( *this ); - return os; -} -``` +You should put this function in the same namespace as your type and it has to be declared before including Catch's header. ## Catch::toString overload @@ -39,11 +30,12 @@ namespace Catch { } ``` -Again ```T``` is your type and ```convertMyTypeToString``` is where you'll write whatever code is necessary to make your type printable. Note that the function must be in the Catch namespace, which itself must be in the global namespace. +Again ```T``` is your type and ```convertMyTypeToString``` is where you'll write whatever code is necessary to make your type printable. Note that the function must be in the Catch namespace, which itself must be in the global namespace and must be declared _before_ Catch's header is included. + +**Please note that overloading `Catch::toString` is currently considered legacy and will not be supported in the next major version of Catch.** ## Catch::StringMaker specialisation - -There are some cases where overloading toString does not work as expected. Specialising StringMaker gives you more precise, and reliable, control - but at the cost of slightly more code and complexity: +Another way of telling Catch how to convert a type to string is specialising `Catch::StringMaker` template. This allows you to have separate way of stringifying types for Catch, than you have for writing it to a stream and also doesn't require you to declare it before including Catch's header. ``` namespace Catch { From b8443e67da47f02ec865ab38edc5756b1895b7e4 Mon Sep 17 00:00:00 2001 From: Antonio Di Monaco Date: Thu, 11 May 2017 13:00:03 +0200 Subject: [PATCH 14/32] Added Win32 UNICODE wmain support (#903) * Added wmain support * Added appveyor.yml wmain configuration * Added wmain configuration flag to CMake --- CMakeLists.txt | 4 ++++ appveyor.yml | 8 +++++++- include/catch_session.hpp | 26 +++++++++++++++++++++++++ include/internal/catch_default_main.hpp | 6 ++++++ 4 files changed, 43 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 8d39bdb8..0bd7dd1f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -19,6 +19,10 @@ elseif(USE_CPP14) set(CMAKE_CXX_FLAGS "-std=c++14 ${CMAKE_CXX_FLAGS}") endif() +if(USE_WMAIN) + set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /ENTRY:wmainCRTStartup") +endif() + #checks that the given hard-coded list contains all headers + sources in the given folder function(CheckFileList LIST_VAR FOLDER) set(MESSAGE " should be added to the variable ${LIST_VAR}") diff --git a/appveyor.yml b/appveyor.yml index f6fce08a..d09c1dd5 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -9,7 +9,13 @@ os: environment: matrix: - additional_flags: "/permissive- /std:c++latest" + wmain: 0 + - additional_flags: "" + wmain: 0 + + - additional_flags: "/D_UNICODE /DUNICODE" + wmain: 1 matrix: exclude: @@ -42,7 +48,7 @@ configuration: #Cmake will autodetect the compiler, but we set the arch before_build: - set CXXFLAGS=%additional_flags% - - cmake -H. -BBuild -A%PLATFORM% + - cmake -H. -BBuild -A%PLATFORM% -DUSE_WMAIN=%wmain% # build with MSBuild build: diff --git a/include/catch_session.hpp b/include/catch_session.hpp index be51bef8..a501634d 100644 --- a/include/catch_session.hpp +++ b/include/catch_session.hpp @@ -166,6 +166,32 @@ namespace Catch { return returnCode; } + #if defined(WIN32) && defined(UNICODE) + int run( int argc, wchar_t const* const* const argv ) { + + char **utf8Argv = new char *[ argc ]; + + for ( int i = 0; i < argc; ++i ) { + int bufSize = WideCharToMultiByte( CP_UTF8, 0, argv[i], -1, NULL, 0, NULL, NULL ); + + utf8Argv[ i ] = new char[ bufSize ]; + + WideCharToMultiByte( CP_UTF8, 0, argv[i], -1, utf8Argv[i], bufSize, NULL, NULL ); + } + + int returnCode = applyCommandLine( argc, utf8Argv ); + if( returnCode == 0 ) + returnCode = run(); + + for ( int i = 0; i < argc; ++i ) + delete [] utf8Argv[ i ]; + + delete [] utf8Argv; + + return returnCode; + } + #endif + int run() { if( m_configData.showHelp ) return 0; diff --git a/include/internal/catch_default_main.hpp b/include/internal/catch_default_main.hpp index a0c4239d..69337244 100644 --- a/include/internal/catch_default_main.hpp +++ b/include/internal/catch_default_main.hpp @@ -10,8 +10,14 @@ #ifndef __OBJC__ +#if defined(WIN32) && defined(_UNICODE) && !defined(DO_NOT_USE_WMAIN) +// Standard C/C++ Win32 Unicode wmain entry point +extern "C" int wmain (int argc, wchar_t * argv[], wchar_t * []) { +#else // Standard C/C++ main entry point int main (int argc, char * argv[]) { +#endif + int result = Catch::Session().run( argc, argv ); return ( result < 0xff ? result : 0xff ); } From d4e0b1d0937597ee92b2677745699021ac20a944 Mon Sep 17 00:00:00 2001 From: Patrick Junger Date: Sun, 14 May 2017 14:11:47 +0200 Subject: [PATCH 15/32] Added namespace in method testCaseEnded Did not compile as is --- docs/event-listeners.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/event-listeners.md b/docs/event-listeners.md index 9ac5cc77..ab057444 100644 --- a/docs/event-listeners.md +++ b/docs/event-listeners.md @@ -31,7 +31,7 @@ struct MyListener : Catch::TestEventListenerBase { // Perform some setup before a test case is run } - virtual void testCaseEnded( TestCaseStats const& testCaseStats ) override { + virtual void testCaseEnded( Catch::TestCaseStats const& testCaseStats ) override { // Tear-down after a test case is run } }; @@ -70,4 +70,4 @@ just look in the source code to see what fields are available. --- -[Home](Readme.md) \ No newline at end of file +[Home](Readme.md) From 589c40077b3f092d5d1215851cb3cbcd51e26404 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Ho=C5=99e=C5=88ovsk=C3=BD?= Date: Tue, 16 May 2017 13:49:53 +0200 Subject: [PATCH 16/32] Typo fix Somehow I made that in 5ffc8a84cda91b5da037a923480236450f7f4586 without noticing --- include/catch.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/catch.hpp b/include/catch.hpp index f258f8a2..c105d9c8 100644 --- a/include/catch.hpp +++ b/include/catch.hpp @@ -136,7 +136,7 @@ LeakDetector leakDetector; #define CATCH_METHOD_AS_TEST_CASE( method, ... ) INTERNAL_CATCH_METHOD_AS_TEST_CASE( method, __VA_ARGS__ ) #define CATCH_REGISTER_TEST_CASE( Function, ... ) INTERNAL_CATCH_REGISTER_TESTCASE( Function, __VA_ARGS__ ) #define CATCH_SECTION( ... ) INTERNAL_CATCH_SECTION( __VA_ARGS__ ) - #define CATCH_FAIL( ... ) INTERNAL_CATCH_MSG( "CATCH_FAIL", Catch::ResultWas::ExplicitFailure, Catch::ResultDisposition::Normal, __VA_ARGS ) + #define CATCH_FAIL( ... ) INTERNAL_CATCH_MSG( "CATCH_FAIL", Catch::ResultWas::ExplicitFailure, Catch::ResultDisposition::Normal, __VA_ARGS__ ) #define CATCH_FAIL_CHECK( ... ) INTERNAL_CATCH_MSG( "CATCH_FAIL_CHECK", Catch::ResultWas::ExplicitFailure, Catch::ResultDisposition::ContinueOnFailure, __VA_ARGS__ ) #define CATCH_SUCCEED( ... ) INTERNAL_CATCH_MSG( "CATCH_SUCCEED", Catch::ResultWas::Ok, Catch::ResultDisposition::ContinueOnFailure, __VA_ARGS__ ) #else From 3dcc9233515ea69e45a11be369f867a944e72e76 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Ho=C5=99e=C5=88ovsk=C3=BD?= Date: Tue, 16 May 2017 13:59:29 +0200 Subject: [PATCH 17/32] v1.9.4 --- README.md | 2 +- docs/release-notes.md | 10 +++++++ include/internal/catch_version.hpp | 2 +- single_include/catch.hpp | 47 +++++++++++++++++++++++++----- 4 files changed, 52 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 3f93d794..0ef573b3 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ [![Build Status](https://travis-ci.org/philsquared/Catch.svg?branch=master)](https://travis-ci.org/philsquared/Catch) [![Build status](https://ci.appveyor.com/api/projects/status/hrtk60hv6tw6fght/branch/master?svg=true)](https://ci.appveyor.com/project/philsquared/catch/branch/master) -The latest, single header, version can be downloaded directly using this link +The latest, single header, version can be downloaded directly using this link ## What's the Catch? diff --git a/docs/release-notes.md b/docs/release-notes.md index 8b12188b..f98d8475 100644 --- a/docs/release-notes.md +++ b/docs/release-notes.md @@ -1,3 +1,13 @@ +# 1.9.4 + +### Fixes +* `CATCH_FAIL` macro no longer causes compilation error without variadic macro support +* `INFO` messages are no longer cleared after being reported once + +### Improvements and minor changes +* Catch now uses `wmain` when compiled under Windows and `UNICODE` is defined. + * Note that Catch still officially supports only ASCII + # 1.9.3 ### Fixes diff --git a/include/internal/catch_version.hpp b/include/internal/catch_version.hpp index 7092f7b7..62ba34f3 100644 --- a/include/internal/catch_version.hpp +++ b/include/internal/catch_version.hpp @@ -38,7 +38,7 @@ namespace Catch { } inline Version libraryVersion() { - static Version version( 1, 9, 3, "", 0 ); + static Version version( 1, 9, 4, "", 0 ); return version; } diff --git a/single_include/catch.hpp b/single_include/catch.hpp index 599eee90..33d037e5 100644 --- a/single_include/catch.hpp +++ b/single_include/catch.hpp @@ -1,6 +1,6 @@ /* - * Catch v1.9.3 - * Generated: 2017-04-25 14:16:29.434734 + * Catch v1.9.4 + * Generated: 2017-05-16 13:51:55.506519 * ---------------------------------------------------------- * This file has been merged from multiple headers. Please don't edit it directly * Copyright (c) 2012 Two Blue Cubes Ltd. All rights reserved. @@ -2272,7 +2272,7 @@ namespace Catch { INTERNAL_CATCH_REACT( __catchResult ) \ } while( Catch::alwaysFalse() ) #else - #define INTERNAL_CATCH_MSG( messageType, resultDisposition, macroName, log ) \ + #define INTERNAL_CATCH_MSG( macroName, messageType, resultDisposition, log ) \ do { \ Catch::ResultBuilder __catchResult( macroName, CATCH_INTERNAL_LINEINFO, "", resultDisposition ); \ __catchResult << log + ::Catch::StreamEndStop(); \ @@ -6642,8 +6642,9 @@ namespace Catch { m_totals.assertions.failed++; } - if( m_reporter->assertionEnded( AssertionStats( result, m_messages, m_totals ) ) ) - m_messages.clear(); + // We have no use for the return value (whether messages should be cleared), because messages were made scoped + // and should be let to clear themselves out. + static_cast(m_reporter->assertionEnded(AssertionStats(result, m_messages, m_totals))); // Reset working state m_lastAssertionInfo = AssertionInfo( std::string(), m_lastAssertionInfo.lineInfo, "{Unknown expression after the reported line}" , m_lastAssertionInfo.resultDisposition ); @@ -7052,6 +7053,32 @@ namespace Catch { return returnCode; } + #if defined(WIN32) && defined(UNICODE) + int run( int argc, wchar_t const* const* const argv ) { + + char **utf8Argv = new char *[ argc ]; + + for ( int i = 0; i < argc; ++i ) { + int bufSize = WideCharToMultiByte( CP_UTF8, 0, argv[i], -1, NULL, 0, NULL, NULL ); + + utf8Argv[ i ] = new char[ bufSize ]; + + WideCharToMultiByte( CP_UTF8, 0, argv[i], -1, utf8Argv[i], bufSize, NULL, NULL ); + } + + int returnCode = applyCommandLine( argc, utf8Argv ); + if( returnCode == 0 ) + returnCode = run(); + + for ( int i = 0; i < argc; ++i ) + delete [] utf8Argv[ i ]; + + delete [] utf8Argv; + + return returnCode; + } + #endif + int run() { if( m_configData.showHelp ) return 0; @@ -8282,7 +8309,7 @@ namespace Catch { } inline Version libraryVersion() { - static Version version( 1, 9, 3, "", 0 ); + static Version version( 1, 9, 4, "", 0 ); return version; } @@ -11268,8 +11295,14 @@ namespace Catch { #ifndef __OBJC__ +#if defined(WIN32) && defined(_UNICODE) && !defined(DO_NOT_USE_WMAIN) +// Standard C/C++ Win32 Unicode wmain entry point +extern "C" int wmain (int argc, wchar_t * argv[], wchar_t * []) { +#else // Standard C/C++ main entry point int main (int argc, char * argv[]) { +#endif + int result = Catch::Session().run( argc, argv ); return ( result < 0xff ? result : 0xff ); } @@ -11349,7 +11382,7 @@ int main (int argc, char * const argv[]) { #define CATCH_METHOD_AS_TEST_CASE( method, ... ) INTERNAL_CATCH_METHOD_AS_TEST_CASE( method, __VA_ARGS__ ) #define CATCH_REGISTER_TEST_CASE( Function, ... ) INTERNAL_CATCH_REGISTER_TESTCASE( Function, __VA_ARGS__ ) #define CATCH_SECTION( ... ) INTERNAL_CATCH_SECTION( __VA_ARGS__ ) - #define CATCH_FAIL( ... ) INTERNAL_CATCH_MSG( Catch::ResultWas::ExplicitFailure, Catch::ResultDisposition::Normal, "CATCH_FAIL", __VA_ARGS__ ) + #define CATCH_FAIL( ... ) INTERNAL_CATCH_MSG( "CATCH_FAIL", Catch::ResultWas::ExplicitFailure, Catch::ResultDisposition::Normal, __VA_ARGS__ ) #define CATCH_FAIL_CHECK( ... ) INTERNAL_CATCH_MSG( "CATCH_FAIL_CHECK", Catch::ResultWas::ExplicitFailure, Catch::ResultDisposition::ContinueOnFailure, __VA_ARGS__ ) #define CATCH_SUCCEED( ... ) INTERNAL_CATCH_MSG( "CATCH_SUCCEED", Catch::ResultWas::Ok, Catch::ResultDisposition::ContinueOnFailure, __VA_ARGS__ ) #else From 1ea84cb734a9724c34525bd8aa2c8fabe1568403 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Ho=C5=99e=C5=88ovsk=C3=BD?= Date: Tue, 16 May 2017 14:34:20 +0200 Subject: [PATCH 18/32] Expanded logging documentation Closes #884 --- docs/logging.md | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/docs/logging.md b/docs/logging.md index 01c6fbc7..afbfd224 100644 --- a/docs/logging.md +++ b/docs/logging.md @@ -1,6 +1,32 @@ # Logging macros -Additional messages can be logged during a test case. +Additional messages can be logged during a test case. Note that the messages are scoped and thus will not be reported if failure occurs in scope preceding the message declaration. An example: + +```cpp +TEST_CASE("Foo") { + INFO("Test case start"); + for (int i = 0; i < 2; ++i) { + INFO("The number is " << i); + CHECK(i == 0); + } +} + +TEST_CASE("Bar") { + INFO("Test case start"); + for (int i = 0; i < 2; ++i) { + INFO("The number is " << i); + CHECK(i == i); + } + CHECK(false); +} +``` +When the `CHECK` fails in the "Foo" test case, then two messages will be printed. +``` +Test case start +The number is 1 +``` +When the last `CHECK` fails in the "Bar" test case, then only one message will be printed: `Test case start`. + ## Streaming macros From df5cf2d32347e52afb994623e32c65d2076db6a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Ho=C5=99e=C5=88ovsk=C3=BD?= Date: Tue, 16 May 2017 14:34:55 +0200 Subject: [PATCH 19/32] Minor fixup in updateVcpkgPackage.py --- scripts/updateVcpkgPackage.py | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/updateVcpkgPackage.py b/scripts/updateVcpkgPackage.py index 299e9f3b..a7c8dee6 100644 --- a/scripts/updateVcpkgPackage.py +++ b/scripts/updateVcpkgPackage.py @@ -96,6 +96,7 @@ def git_push(path_to_repo): # Update repo to current master, so we don't work off old version of the portsfile subprocess.call('git pull Microsoft master', shell=True) + subprocess.call('git push', shell=True) # Create a new branch for the update subprocess.call('git checkout -b catch-{}'.format(ver_string), shell=True) From bc93b2978955a68d8fabd07fb22a0946788849d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Ho=C5=99e=C5=88ovsk=C3=BD?= Date: Tue, 16 May 2017 15:28:53 +0200 Subject: [PATCH 20/32] Expanded tag documentation It now mentions that most characters are valid as part of tag and other details. Closes #909 --- docs/test-cases-and-sections.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/test-cases-and-sections.md b/docs/test-cases-and-sections.md index 2a14e86e..862b1ef5 100644 --- a/docs/test-cases-and-sections.md +++ b/docs/test-cases-and-sections.md @@ -28,7 +28,7 @@ The tag expression, ```"[widget]"``` selects A, B & D. ```"[gadget]"``` selects For more detail on command line selection see [the command line docs](command-line.md#specifying-which-tests-to-run) -Tag names are not case sensitive. +Tag names are not case sensitive and can contain any ASCII characters. This means that tags `[tag with spaces]` and `[I said "good day"]` are both allowed tags and can be filtered on. Escapes are not supported however and `[\]] is not a valid tag. ### Special Tags From 32d97caf4229e80ae3409bc7c2f19f9bacdce3df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Ho=C5=99e=C5=88ovsk=C3=BD?= Date: Tue, 16 May 2017 15:45:44 +0200 Subject: [PATCH 21/32] Fixed missing ` in tag documentation --- docs/test-cases-and-sections.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/test-cases-and-sections.md b/docs/test-cases-and-sections.md index 862b1ef5..4e53c35c 100644 --- a/docs/test-cases-and-sections.md +++ b/docs/test-cases-and-sections.md @@ -28,7 +28,7 @@ The tag expression, ```"[widget]"``` selects A, B & D. ```"[gadget]"``` selects For more detail on command line selection see [the command line docs](command-line.md#specifying-which-tests-to-run) -Tag names are not case sensitive and can contain any ASCII characters. This means that tags `[tag with spaces]` and `[I said "good day"]` are both allowed tags and can be filtered on. Escapes are not supported however and `[\]] is not a valid tag. +Tag names are not case sensitive and can contain any ASCII characters. This means that tags `[tag with spaces]` and `[I said "good day"]` are both allowed tags and can be filtered on. Escapes are not supported however and `[\]]` is not a valid tag. ### Special Tags From d271683c147d7168c0c84356ce48bdb7e105ee81 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Ho=C5=99e=C5=88ovsk=C3=BD?= Date: Tue, 16 May 2017 21:33:58 +0200 Subject: [PATCH 22/32] Added release process notes/checklist/explanation --- docs/release-process.md | 44 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 docs/release-process.md diff --git a/docs/release-process.md b/docs/release-process.md new file mode 100644 index 00000000..cfb7a289 --- /dev/null +++ b/docs/release-process.md @@ -0,0 +1,44 @@ +# How to release + +When enough changes have accumulated, it is time to release new version of Catch. This document describes the proces in doing so, that no steps are forgotten. Note that all referenced scripts can be found in the `scripts/` directory. + + +## Approval testing + +Catch's releases are primarily validated against output from previous release, stored in `projects/SelfTest/Baselines`. To validate current sources, build the SelfTest binary and pass it to the `approvalTests.py` script: `approvalTests.py `. + +There should be no differences, as Approval tests should be updated when changes to Catch are made, but if there are, then they need to be manually reviewed and either approved (using `approve.py`) or Catch requires other fixes. + + +## Incrementing version number + +Catch uses a variant of [semantic versioning](http://semver.org/), with breaking API changes (and thus major version increments) being very rare. Thus, the release will usually increment the patch version, when it only contains couple of bugfixes, or minor version, when it contains new functionality, or larger changes in implementation of current functionality. + +After deciding which part of version number should be incremented, you can use one of the `*Release.py` scripts to perform the required changes to Catch. + + +## Generate updated single-include header + +After updating version number, regenerate single-include header using `generateSingleHeader.py`. + + +## Release notes + +Once a release is ready, release notes need to be written. They should summarize changes done since last release. For rough idea of expected notes see previous releases. Once written, release notes should be placed in `docs/release-notes.md`. + + +## Commit and push update to GitHub + +After version number is incremented, single-include header is regenerated and release notes are updated, changes should be commited and pushed to GitHub. + + +## Release on GitHub + +After pushing changes to GitHub, GitHub release *needs* to be created. Tag version and release title should be same as the new version, description should contain the release notes for the current release. Single header version of `catch.hpp` *needs* to be attached as a binary, as that is where the official download link links to. Preferably it should use linux line endings. + + +## vcpkg update + +As a last step, optionally update Microsoft's package manager [vcpkg](https://github.com/Microsoft/vcpkg) with Catch's new version. `updateVcpkgPackage.py` can do a lot of neccessary work for you, but it assumes that you have your fork of vcpkg checked out in a directory next to the directory, where you have checked out Catch. + +It creates a branch and commits neccessary changes, that you then should review, synchronize and open a PR against. From a49fa0edbe6d25a5f6b92721beb3f5d2ca10ecc3 Mon Sep 17 00:00:00 2001 From: dvirtz Date: Thu, 18 May 2017 15:51:44 +0300 Subject: [PATCH 23/32] use absolute path to test files - accroding to CMake docs EXISTS behavior is well-defined only for full paths. --- contrib/ParseAndAddCatchTests.cmake | 2 ++ 1 file changed, 2 insertions(+) diff --git a/contrib/ParseAndAddCatchTests.cmake b/contrib/ParseAndAddCatchTests.cmake index a81de4b8..1b96802f 100644 --- a/contrib/ParseAndAddCatchTests.cmake +++ b/contrib/ParseAndAddCatchTests.cmake @@ -47,6 +47,8 @@ endfunction() # Worker function function(ParseFile SourceFile TestTarget) + # accroding to CMake docs EXISTS behavior is well-defined only for full paths. + get_filename_component(SourceFile ${SourceFile} ABSOLUTE) if(NOT EXISTS ${SourceFile}) message(WARNING "Cannot find source file: ${SourceFile}") return() From aac594aae3697badc32142fa14f87ef26af357b6 Mon Sep 17 00:00:00 2001 From: dvirtz Date: Thu, 18 May 2017 15:53:35 +0300 Subject: [PATCH 24/32] add option to print debug messages --- contrib/ParseAndAddCatchTests.cmake | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/contrib/ParseAndAddCatchTests.cmake b/contrib/ParseAndAddCatchTests.cmake index 1b96802f..42c6f34f 100644 --- a/contrib/ParseAndAddCatchTests.cmake +++ b/contrib/ParseAndAddCatchTests.cmake @@ -25,10 +25,24 @@ # # # include(ParseAndAddCatchTests) # # ParseAndAddCatchTests(${PROJECT_NAME}) # +# # +# The following variables affect the behavior of the script: # +# # +# PARSE_CATCH_TESTS_VERBOSE (Default OFF) # +# -- enabels debug messages # +# # #==================================================================================================# cmake_minimum_required(VERSION 2.8.8) +option(PARSE_CATCH_TESTS_VERBOSE "Print Catch to CTest parser debug messages" OFF) + +function(PrintDebugMessage) + if(PARSE_CATCH_TESTS_VERBOSE) + message(STATUS "ParseAndAddCatchTests: ${ARGV}") + endif() +endfunction() + # This removes the contents between # - block comments (i.e. /* ... */) # - full line comments (i.e. // ... ) @@ -53,6 +67,7 @@ function(ParseFile SourceFile TestTarget) message(WARNING "Cannot find source file: ${SourceFile}") return() endif() + PrintDebugMessage("parsing ${SourceFile}") file(STRINGS ${SourceFile} Contents NEWLINE_CONSUME) # Remove block and fullline comments @@ -99,6 +114,8 @@ function(ParseFile SourceFile TestTarget) string(REPLACE "]" ";" Tags "${Tags}") string(REPLACE "[" "" Tags "${Tags}") endif() + + PrintDebugMessage("Adding test \"${CTestName}\"") # Add the test and set its properties add_test(NAME "\"${CTestName}\"" COMMAND ${TestTarget} ${Name} ${AdditionalCatchParameters}) @@ -110,8 +127,11 @@ endfunction() # entry point function(ParseAndAddCatchTests TestTarget) + PrintDebugMessage("Started parsing ${TestTarget}") get_target_property(SourceFiles ${TestTarget} SOURCES) + PrintDebugMessage("Found the following sources: ${SourceFiles}") foreach(SourceFile ${SourceFiles}) ParseFile(${SourceFile} ${TestTarget}) endforeach() + PrintDebugMessage("Finished parsing ${TestTarget}") endfunction() From 4b086bd5b5e2e03a60f59b3e3101baab996f2c7c Mon Sep 17 00:00:00 2001 From: dvirtz Date: Thu, 18 May 2017 16:00:18 +0300 Subject: [PATCH 25/32] added target name to test name and labels --- contrib/ParseAndAddCatchTests.cmake | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/contrib/ParseAndAddCatchTests.cmake b/contrib/ParseAndAddCatchTests.cmake index 42c6f34f..6c3e6632 100644 --- a/contrib/ParseAndAddCatchTests.cmake +++ b/contrib/ParseAndAddCatchTests.cmake @@ -108,19 +108,31 @@ function(ParseFile SourceFile TestTarget) else() set(CTestName "${Name}") endif() + set(CTestName "${TestTarget}:${CTestName}") + # add target to labels to enable running all tests added from this target + set(Labels ${TestTarget}) if(TestStringsLength EQUAL 2) list(GET TestStrings 1 Tags) string(TOLOWER "${Tags}" Tags) + # remove target from labels if the test is hidden + if("${Tags}" MATCHES ".*\\[!?(hide|\\.)\\].*") + list(REMOVE_ITEM Labels ${TestTarget}) + endif() string(REPLACE "]" ";" Tags "${Tags}") string(REPLACE "[" "" Tags "${Tags}") endif() + list(APPEND Labels ${Tags}) + PrintDebugMessage("Adding test \"${CTestName}\"") + if(Labels) + PrintDebugMessage("Setting labels to ${Labels}") + endif() # Add the test and set its properties add_test(NAME "\"${CTestName}\"" COMMAND ${TestTarget} ${Name} ${AdditionalCatchParameters}) set_tests_properties("\"${CTestName}\"" PROPERTIES FAIL_REGULAR_EXPRESSION "No tests ran" - LABELS "${Tags}") + LABELS "${Labels}") endforeach() endfunction() From b18e67522f057ab0254c8b0127e1263bfeaef572 Mon Sep 17 00:00:00 2001 From: Austin L Wolfgram Date: Sat, 20 May 2017 15:10:42 -0400 Subject: [PATCH 26/32] fixed spelling error --- docs/tutorial.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/tutorial.md b/docs/tutorial.md index 73924592..3a0f9468 100644 --- a/docs/tutorial.md +++ b/docs/tutorial.md @@ -68,7 +68,7 @@ with expansion: 0 == 1 ``` -Note that we get the actual return value of Factorial(0) printed for us (0) - even though we used a natural expression with the == operator. That let's us immediately see what the problem is. +Note that we get the actual return value of Factorial(0) printed for us (0) - even though we used a natural expression with the == operator. That lets us immediately see what the problem is. Let's change the factorial function to: From 52a84788e0e7c53c5c410b58492281da0e8b2e8a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Ho=C5=99e=C5=88ovsk=C3=BD?= Date: Sat, 27 May 2017 12:23:35 +0200 Subject: [PATCH 27/32] Add Inscopix to commercial users Closes #918 --- docs/commercial-users.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/commercial-users.md b/docs/commercial-users.md index 1a7db9c4..424eb22c 100644 --- a/docs/commercial-users.md +++ b/docs/commercial-users.md @@ -13,4 +13,4 @@ fact then please let us know - either directly, via a PR or - Bloomberg - NASA - + - [Inscopix Inc.](https://www.inscopix.com/) From 2d1739b42962f298c413210286eaf3f69e5a1eed Mon Sep 17 00:00:00 2001 From: twhittock Date: Sat, 27 May 2017 13:09:44 +0100 Subject: [PATCH 28/32] ExpressionLhs reconstruction based on value, not truthiness (#914) Types which are truthy, but have more information than the truthiness in their string conversion were showing up as 'true' or 'false' instead of showing the underlying type's string value. --- include/internal/catch_expression_lhs.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/internal/catch_expression_lhs.hpp b/include/internal/catch_expression_lhs.hpp index 106a6b0a..7133e09b 100644 --- a/include/internal/catch_expression_lhs.hpp +++ b/include/internal/catch_expression_lhs.hpp @@ -81,7 +81,7 @@ public: } virtual void reconstructExpression( std::string& dest ) const CATCH_OVERRIDE { - dest = Catch::toString( m_truthy ); + dest = Catch::toString( m_lhs ); } private: From ea48ae0f753121476b525584744c236dc22d73db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Ho=C5=99e=C5=88ovsk=C3=BD?= Date: Sat, 27 May 2017 14:42:05 +0200 Subject: [PATCH 29/32] Add test for #914 (stringify truthy exprs in standard way) --- CMakeLists.txt | 1 + .../Baselines/console.std.approved.txt | 15 ++++++++-- .../Baselines/console.sw.approved.txt | 21 ++++++++++---- .../SelfTest/Baselines/junit.sw.approved.txt | 7 ++++- .../SelfTest/Baselines/xml.sw.approved.txt | 21 ++++++++++---- projects/SelfTest/DecompositionTests.cpp | 28 +++++++++++++++++++ 6 files changed, 80 insertions(+), 13 deletions(-) create mode 100644 projects/SelfTest/DecompositionTests.cpp diff --git a/CMakeLists.txt b/CMakeLists.txt index 0bd7dd1f..6e608fa3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -59,6 +59,7 @@ set(TEST_SOURCES ${SELF_TEST_DIR}/CmdLineTests.cpp ${SELF_TEST_DIR}/CompilationTests.cpp ${SELF_TEST_DIR}/ConditionTests.cpp + ${SELF_TEST_DIR}/DecompositionTests.cpp ${SELF_TEST_DIR}/EnumToString.cpp ${SELF_TEST_DIR}/ExceptionTests.cpp ${SELF_TEST_DIR}/GeneratorTests.cpp diff --git a/projects/SelfTest/Baselines/console.std.approved.txt b/projects/SelfTest/Baselines/console.std.approved.txt index 0ad362e9..19e545ba 100644 --- a/projects/SelfTest/Baselines/console.std.approved.txt +++ b/projects/SelfTest/Baselines/console.std.approved.txt @@ -595,6 +595,17 @@ MessageTests.cpp:: warning: toString(p): 0x +------------------------------------------------------------------------------- +Reconstruction should be based on stringification: #914 +------------------------------------------------------------------------------- +DecompositionTests.cpp: +............................................................................... + +DecompositionTests.cpp:: FAILED: + CHECK( truthy(false) ) +with expansion: + Hey, its truthy! + ------------------------------------------------------------------------------- SCOPED_INFO is reset for each loop ------------------------------------------------------------------------------- @@ -942,6 +953,6 @@ with expansion: "first" == "second" =============================================================================== -test cases: 167 | 119 passed | 44 failed | 4 failed as expected -assertions: 967 | 859 passed | 87 failed | 21 failed as expected +test cases: 168 | 119 passed | 45 failed | 4 failed as expected +assertions: 968 | 859 passed | 88 failed | 21 failed as expected diff --git a/projects/SelfTest/Baselines/console.sw.approved.txt b/projects/SelfTest/Baselines/console.sw.approved.txt index c1d8865a..cdc414a4 100644 --- a/projects/SelfTest/Baselines/console.sw.approved.txt +++ b/projects/SelfTest/Baselines/console.sw.approved.txt @@ -819,7 +819,7 @@ TrickyTests.cpp:: PASSED: REQUIRE( a ) with expansion: - true + 0x TrickyTests.cpp:: PASSED: @@ -4571,7 +4571,7 @@ TrickyTests.cpp:: PASSED: CHECK( True ) with expansion: - true + 1 TrickyTests.cpp:: PASSED: @@ -4583,7 +4583,7 @@ TrickyTests.cpp:: PASSED: CHECK_FALSE( False ) with expansion: - !false + !0 ------------------------------------------------------------------------------- Operators at different namespace levels not hijacked by Koenig lookup @@ -6437,6 +6437,17 @@ TestMain.cpp:: PASSED: REQUIRE_THROWS_WITH( parseIntoConfig( argv, config ), Contains( "colour mode must be one of" ) ) +------------------------------------------------------------------------------- +Reconstruction should be based on stringification: #914 +------------------------------------------------------------------------------- +DecompositionTests.cpp: +............................................................................... + +DecompositionTests.cpp:: FAILED: + CHECK( truthy(false) ) +with expansion: + Hey, its truthy! + ------------------------------------------------------------------------------- SCOPED_INFO is reset for each loop ------------------------------------------------------------------------------- @@ -9472,6 +9483,6 @@ MiscTests.cpp:: PASSED: =============================================================================== -test cases: 167 | 118 passed | 45 failed | 4 failed as expected -assertions: 969 | 859 passed | 89 failed | 21 failed as expected +test cases: 168 | 118 passed | 46 failed | 4 failed as expected +assertions: 970 | 859 passed | 90 failed | 21 failed as expected diff --git a/projects/SelfTest/Baselines/junit.sw.approved.txt b/projects/SelfTest/Baselines/junit.sw.approved.txt index 6237fb63..b723f207 100644 --- a/projects/SelfTest/Baselines/junit.sw.approved.txt +++ b/projects/SelfTest/Baselines/junit.sw.approved.txt @@ -1,6 +1,6 @@ - + @@ -443,6 +443,11 @@ MessageTests.cpp: + + +DecompositionTests.cpp: + + current counter 10 diff --git a/projects/SelfTest/Baselines/xml.sw.approved.txt b/projects/SelfTest/Baselines/xml.sw.approved.txt index 83d9a421..6361fee3 100644 --- a/projects/SelfTest/Baselines/xml.sw.approved.txt +++ b/projects/SelfTest/Baselines/xml.sw.approved.txt @@ -890,7 +890,7 @@ a - true + 0x @@ -4695,7 +4695,7 @@ re>" True - true + 1 @@ -4711,7 +4711,7 @@ re>" !False - !false + !0 @@ -6912,6 +6912,17 @@ re>" + + + + truthy(false) + + + Hey, its truthy! + + + + current counter 0 @@ -10132,7 +10143,7 @@ spanner - + - + diff --git a/projects/SelfTest/DecompositionTests.cpp b/projects/SelfTest/DecompositionTests.cpp new file mode 100644 index 00000000..f2e04260 --- /dev/null +++ b/projects/SelfTest/DecompositionTests.cpp @@ -0,0 +1,28 @@ +/* + * Created by Martin on 27/5/2017. + * Copyright 2017 Two Blue Cubes Ltd. All rights reserved. + * + * 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 + +struct truthy { + truthy(bool b):m_value(b){} + operator bool() const { + return false; + } + bool m_value; +}; + +std::ostream& operator<<(std::ostream& o, truthy) { + o << "Hey, its truthy!"; + return o; +} + +#include "catch.hpp" + +TEST_CASE( "Reconstruction should be based on stringification: #914" , "[Decomposition][failing][.]") { + CHECK(truthy(false)); +} From 377c9a746d1623ff51f8d48dde72f090ad960cd8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Ho=C5=99e=C5=88ovsk=C3=BD?= Date: Sat, 27 May 2017 14:42:54 +0200 Subject: [PATCH 30/32] Cosmetic fixes (whitespace and spelling) --- contrib/ParseAndAddCatchTests.cmake | 14 +++++++------- include/catch.hpp | 20 ++++++++++---------- include/internal/catch_assertionresult.h | 4 ++-- include/internal/catch_capture.hpp | 2 +- include/internal/catch_default_main.hpp | 2 +- include/internal/catch_fatal_condition.hpp | 4 ++-- include/internal/catch_objc.hpp | 2 +- include/internal/catch_option.hpp | 2 +- include/internal/catch_run_context.hpp | 2 +- include/internal/catch_type_traits.hpp | 2 +- include/reporters/catch_reporter_bases.hpp | 2 +- projects/SelfTest/MiscTests.cpp | 2 +- projects/SelfTest/ToStringGeneralTests.cpp | 3 +-- 13 files changed, 30 insertions(+), 31 deletions(-) diff --git a/contrib/ParseAndAddCatchTests.cmake b/contrib/ParseAndAddCatchTests.cmake index 6c3e6632..bd1da755 100644 --- a/contrib/ParseAndAddCatchTests.cmake +++ b/contrib/ParseAndAddCatchTests.cmake @@ -25,11 +25,11 @@ # # # include(ParseAndAddCatchTests) # # ParseAndAddCatchTests(${PROJECT_NAME}) # -# # +# # # The following variables affect the behavior of the script: # # # # PARSE_CATCH_TESTS_VERBOSE (Default OFF) # -# -- enabels debug messages # +# -- enables debug messages # # # #==================================================================================================# @@ -44,8 +44,8 @@ function(PrintDebugMessage) endfunction() # This removes the contents between -# - block comments (i.e. /* ... */) -# - full line comments (i.e. // ... ) +# - block comments (i.e. /* ... */) +# - full line comments (i.e. // ... ) # contents have been read into '${CppCode}'. # !keep partial line comments function(RemoveComments CppCode) @@ -61,7 +61,7 @@ endfunction() # Worker function function(ParseFile SourceFile TestTarget) - # accroding to CMake docs EXISTS behavior is well-defined only for full paths. + # According to CMake docs EXISTS behavior is well-defined only for full paths. get_filename_component(SourceFile ${SourceFile} ABSOLUTE) if(NOT EXISTS ${SourceFile}) message(WARNING "Cannot find source file: ${SourceFile}") @@ -121,9 +121,9 @@ function(ParseFile SourceFile TestTarget) string(REPLACE "]" ";" Tags "${Tags}") string(REPLACE "[" "" Tags "${Tags}") endif() - + list(APPEND Labels ${Tags}) - + PrintDebugMessage("Adding test \"${CTestName}\"") if(Labels) PrintDebugMessage("Setting labels to ${Labels}") diff --git a/include/catch.hpp b/include/catch.hpp index c105d9c8..f2d9f3da 100644 --- a/include/catch.hpp +++ b/include/catch.hpp @@ -57,16 +57,16 @@ #include class LeakDetector { public: - LeakDetector() { - int flag = _CrtSetDbgFlag(_CRTDBG_REPORT_FLAG); - flag |= _CRTDBG_LEAK_CHECK_DF; - flag |= _CRTDBG_ALLOC_MEM_DF; - _CrtSetDbgFlag(flag); - _CrtSetReportMode(_CRT_WARN, _CRTDBG_MODE_FILE | _CRTDBG_MODE_DEBUG); - _CrtSetReportFile(_CRT_WARN, _CRTDBG_FILE_STDERR); - // Change this to leaking allocation's number to break there - _CrtSetBreakAlloc(-1); - } + LeakDetector() { + int flag = _CrtSetDbgFlag(_CRTDBG_REPORT_FLAG); + flag |= _CRTDBG_LEAK_CHECK_DF; + flag |= _CRTDBG_ALLOC_MEM_DF; + _CrtSetDbgFlag(flag); + _CrtSetReportMode(_CRT_WARN, _CRTDBG_MODE_FILE | _CRTDBG_MODE_DEBUG); + _CrtSetReportFile(_CRT_WARN, _CRTDBG_FILE_STDERR); + // Change this to leaking allocation's number to break there + _CrtSetBreakAlloc(-1); + } }; #else class LeakDetector {}; diff --git a/include/internal/catch_assertionresult.h b/include/internal/catch_assertionresult.h index a193c556..22d1355e 100644 --- a/include/internal/catch_assertionresult.h +++ b/include/internal/catch_assertionresult.h @@ -33,8 +33,8 @@ namespace Catch { template STATIC_ASSERT_Expression_Too_Complex_Please_Rewrite_As_Binary_Comparison& operator && ( T const& ); template STATIC_ASSERT_Expression_Too_Complex_Please_Rewrite_As_Binary_Comparison& operator || ( T const& ); - private: - DecomposedExpression& operator = (DecomposedExpression const&); + private: + DecomposedExpression& operator = (DecomposedExpression const&); }; struct AssertionInfo diff --git a/include/internal/catch_capture.hpp b/include/internal/catch_capture.hpp index 928b06c9..a6d25dad 100644 --- a/include/internal/catch_capture.hpp +++ b/include/internal/catch_capture.hpp @@ -60,7 +60,7 @@ // source code rather than in Catch library code #define INTERNAL_CATCH_REACT( resultBuilder ) \ if( resultBuilder.shouldDebugBreak() ) CATCH_BREAK_INTO_DEBUGGER(); \ - resultBuilder.react(); + resultBuilder.react(); #endif diff --git a/include/internal/catch_default_main.hpp b/include/internal/catch_default_main.hpp index 69337244..e9f466c0 100644 --- a/include/internal/catch_default_main.hpp +++ b/include/internal/catch_default_main.hpp @@ -18,7 +18,7 @@ extern "C" int wmain (int argc, wchar_t * argv[], wchar_t * []) { int main (int argc, char * argv[]) { #endif - int result = Catch::Session().run( argc, argv ); + int result = Catch::Session().run( argc, argv ); return ( result < 0xff ? result : 0xff ); } diff --git a/include/internal/catch_fatal_condition.hpp b/include/internal/catch_fatal_condition.hpp index 1d6674fc..1dcd545d 100644 --- a/include/internal/catch_fatal_condition.hpp +++ b/include/internal/catch_fatal_condition.hpp @@ -28,7 +28,7 @@ namespace Catch { namespace Catch { struct FatalConditionHandler { - void reset() {} + void reset() {} }; } @@ -106,7 +106,7 @@ namespace Catch { namespace Catch { struct FatalConditionHandler { - void reset() {} + void reset() {} }; } diff --git a/include/internal/catch_objc.hpp b/include/internal/catch_objc.hpp index 616383b1..2e349315 100644 --- a/include/internal/catch_objc.hpp +++ b/include/internal/catch_objc.hpp @@ -104,7 +104,7 @@ namespace Catch { namespace Matchers { namespace Impl { namespace NSStringMatchers { - + struct StringHolder : MatcherBase{ StringHolder( NSString* substr ) : m_substr( [substr copy] ){} StringHolder( StringHolder const& other ) : m_substr( [other.m_substr copy] ){} diff --git a/include/internal/catch_option.hpp b/include/internal/catch_option.hpp index 909e5cec..02f849dd 100644 --- a/include/internal/catch_option.hpp +++ b/include/internal/catch_option.hpp @@ -69,7 +69,7 @@ namespace Catch { T *nullableValue; union { char storage[sizeof(T)]; - + // These are here to force alignment for the storage long double dummy1; void (*dummy2)(); diff --git a/include/internal/catch_run_context.hpp b/include/internal/catch_run_context.hpp index f9d3607a..572b54d1 100644 --- a/include/internal/catch_run_context.hpp +++ b/include/internal/catch_run_context.hpp @@ -300,7 +300,7 @@ namespace Catch { // This just means the test was aborted due to failure } catch(...) { - // Under CATCH_CONFIG_FAST_COMPILE, unexpected exceptions under REQUIRE assertions + // Under CATCH_CONFIG_FAST_COMPILE, unexpected exceptions under REQUIRE assertions // are reported without translation at the point of origin. if (m_shouldReportUnexpected) { makeUnexpectedResultBuilder().useActiveException(); diff --git a/include/internal/catch_type_traits.hpp b/include/internal/catch_type_traits.hpp index 9be89162..2094ba5b 100644 --- a/include/internal/catch_type_traits.hpp +++ b/include/internal/catch_type_traits.hpp @@ -25,7 +25,7 @@ namespace Catch { #else template - struct add_const { + struct add_const { typedef const T type; }; diff --git a/include/reporters/catch_reporter_bases.hpp b/include/reporters/catch_reporter_bases.hpp index aca5f355..de7d96d5 100644 --- a/include/reporters/catch_reporter_bases.hpp +++ b/include/reporters/catch_reporter_bases.hpp @@ -28,7 +28,7 @@ namespace Catch { // + 1 for null terminator const size_t maxDoubleSize = DBL_MAX_10_EXP + 1 + 1 + 3 + 1; char buffer[maxDoubleSize]; - + // Save previous errno, to prevent sprintf from overwriting it ErrnoGuard guard; #ifdef _MSC_VER diff --git a/projects/SelfTest/MiscTests.cpp b/projects/SelfTest/MiscTests.cpp index 02099a71..24e3d7d3 100644 --- a/projects/SelfTest/MiscTests.cpp +++ b/projects/SelfTest/MiscTests.cpp @@ -403,5 +403,5 @@ static int f() { TEST_CASE( "#835 -- errno should not be touched by Catch", "[!shouldfail]" ) { errno = 1; CHECK(f() == 0); - REQUIRE(errno == 1); // Check that f() doesn't touch errno. + REQUIRE(errno == 1); // Check that f() doesn't touch errno. } diff --git a/projects/SelfTest/ToStringGeneralTests.cpp b/projects/SelfTest/ToStringGeneralTests.cpp index bca913fb..743882b1 100644 --- a/projects/SelfTest/ToStringGeneralTests.cpp +++ b/projects/SelfTest/ToStringGeneralTests.cpp @@ -9,7 +9,6 @@ TEST_CASE( "Character pretty printing" ){ - // SECTION("Specifically escaped"){ char tab = '\t'; char newline = '\n'; @@ -36,7 +35,7 @@ TEST_CASE( "Character pretty printing" ){ char c = static_cast(i); REQUIRE(c == i); } - } + } } From adb66f55a7f99147a8e3b4f9781399d9262d4e09 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Ho=C5=99e=C5=88ovsk=C3=BD?= Date: Fri, 2 Jun 2017 19:10:57 +0200 Subject: [PATCH 31/32] Don't include warning headers from catch_xmlwriter.hpp This prevents Catch from disabling `Wpadded` for Clang inside test files (files that do not define either `CATCH_CONFIG_MAIN` or `CATCH_CONFIG_RUNNER`). catch_suppress_warnings.h and catch_reenable_warnings.h should be included only once*, so that the stitching script includes them as the first and last header respectively, since it only includes each header once. This caused a bug, where the first one was included properly, but the second one was included prematurely, from catch_xmlwriter.hpp, and thus was guarded by `CATCH_IMPL`. * At least until the stitching script is changed to accomodate common warning disabling header. Fixes #871 --- include/internal/catch_xmlwriter.hpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/include/internal/catch_xmlwriter.hpp b/include/internal/catch_xmlwriter.hpp index ae59627c..224c23a5 100644 --- a/include/internal/catch_xmlwriter.hpp +++ b/include/internal/catch_xmlwriter.hpp @@ -10,7 +10,6 @@ #include "catch_stream.h" #include "catch_compiler_capabilities.h" -#include "catch_suppress_warnings.h" #include #include @@ -241,6 +240,5 @@ namespace Catch { }; } -#include "catch_reenable_warnings.h" #endif // TWOBLUECUBES_CATCH_XMLWRITER_HPP_INCLUDED From 3e018ef131878f32950d3622300e282c1c8a6594 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Ho=C5=99e=C5=88ovsk=C3=BD?= Date: Sun, 4 Jun 2017 12:17:59 +0200 Subject: [PATCH 32/32] Add link to external gcov/lcov example to documentation An alternate take on #916, that better slots into the existing documentation. Closes #916 --- docs/Readme.md | 2 +- docs/build-systems.md | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/docs/Readme.md b/docs/Readme.md index e7e69080..36048ff8 100644 --- a/docs/Readme.md +++ b/docs/Readme.md @@ -17,7 +17,7 @@ Fine tuning: Running: * [Command line](command-line.md) -* [Build systems](build-systems.md) +* [CI and Build system integration](build-systems.md) FAQ: * [Why are my tests slow to compile?](slow-compiles.md) diff --git a/docs/build-systems.md b/docs/build-systems.md index 437bedc9..b9644e53 100644 --- a/docs/build-systems.md +++ b/docs/build-systems.md @@ -1,4 +1,4 @@ -# Integration with build systems +# CI and build system integration Build Systems may refer to low-level tools, like CMake, or larger systems that run on servers, like Jenkins or TeamCity. This page will talk about both. @@ -134,6 +134,10 @@ TEST_CASE("Test3", "[a][b][c]") { ``` would be registered as 3 tests, `Test1`, `Test2` and `Test3`, and ctest 4 labels would be created, `a`, `b`, `c` and `unit`. +### CodeCoverage module (GCOV, LCOV...) + +If you are using GCOV tool to get testing coverage of your code, and are not sure how to integrate it with CMake and Catch, there should be an external example over at https://github.com/fkromer/catch_cmake_coverage + --- -[Home](Readme.md) \ No newline at end of file +[Home](Readme.md)