mirror of
https://github.com/catchorg/Catch2.git
synced 2025-12-20 00:52:11 +01:00
Compare commits
11 Commits
devel-gene
...
devel-new-
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b25dff20c7 | ||
|
|
97091636d0 | ||
|
|
f80956a43a | ||
|
|
32eac2d1bb | ||
|
|
e849735e11 | ||
|
|
d26f763180 | ||
|
|
5e44382423 | ||
|
|
985a3f4460 | ||
|
|
a1faad9315 | ||
|
|
31ee3beb0a | ||
|
|
3b853aa9fb |
4
.github/workflows/mac-builds.yml
vendored
4
.github/workflows/mac-builds.yml
vendored
@@ -4,13 +4,11 @@ on: [push, pull_request]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
# From macos-14 forward, the baseline "macos-X" image is Arm based,
|
||||
# and not Intel based.
|
||||
runs-on: ${{matrix.image}}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
image: [macos-13, macos-14, macos-15]
|
||||
image: [macos-15, macos-15-intel]
|
||||
build_type: [Debug, Release]
|
||||
std: [14, 17]
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ in-memory logs if they are not needed (the test case passed).
|
||||
Unlike reporters, each registered event listener is always active. Event
|
||||
listeners are always notified before reporter(s).
|
||||
|
||||
To write your own event listener, you should derive from `Catch::TestEventListenerBase`,
|
||||
To write your own event listener, you should derive from `Catch::EventListenerBase`,
|
||||
as it provides empty stubs for all reporter events, allowing you to
|
||||
only override events you care for. Afterwards you have to register it
|
||||
with Catch2 using `CATCH_REGISTER_LISTENER` macro, so that Catch2 knows
|
||||
|
||||
@@ -275,7 +275,7 @@ There are two ways to handle this, depending on whether you want this
|
||||
to be an error or not.
|
||||
|
||||
* If empty generator **is** an error, throw an exception in constructor.
|
||||
* If empty generator **is not** an error, use the [`SKIP`](skipping-passing-failing.md#skipping-test-cases-at-runtime) in constructor.
|
||||
* If empty generator **is not** an error, use the [`SKIP` macro](skipping-passing-failing.md#skipping-test-cases-at-runtime) in constructor.
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -87,7 +87,7 @@ TEST_CASE("complex test case") {
|
||||
```
|
||||
|
||||
This test case will report 5 passing assertions; one for each of the three
|
||||
values in section `a1`, and then two in section `a2`, from values 2 and 4.
|
||||
values in section `a1`, and then two in section `a2`, from values 2 and 6.
|
||||
|
||||
Note that as soon as one section is skipped, the entire test case will
|
||||
be reported as _skipped_ (unless there is a failing assertion, in which
|
||||
|
||||
@@ -140,6 +140,7 @@ set(IMPL_HEADERS
|
||||
${SOURCES_DIR}/internal/catch_test_registry.hpp
|
||||
${SOURCES_DIR}/internal/catch_test_spec_parser.hpp
|
||||
${SOURCES_DIR}/internal/catch_textflow.hpp
|
||||
${SOURCES_DIR}/internal/catch_thread_local.hpp
|
||||
${SOURCES_DIR}/internal/catch_thread_support.hpp
|
||||
${SOURCES_DIR}/internal/catch_to_string.hpp
|
||||
${SOURCES_DIR}/internal/catch_uncaught_exceptions.hpp
|
||||
|
||||
@@ -122,6 +122,7 @@
|
||||
#include <catch2/internal/catch_test_registry.hpp>
|
||||
#include <catch2/internal/catch_test_spec_parser.hpp>
|
||||
#include <catch2/internal/catch_textflow.hpp>
|
||||
#include <catch2/internal/catch_thread_local.hpp>
|
||||
#include <catch2/internal/catch_thread_support.hpp>
|
||||
#include <catch2/internal/catch_to_string.hpp>
|
||||
#include <catch2/internal/catch_uncaught_exceptions.hpp>
|
||||
|
||||
@@ -265,7 +265,7 @@ namespace Catch {
|
||||
( "list all listeners" )
|
||||
| Opt( setTestOrder, "decl|lex|rand" )
|
||||
["--order"]
|
||||
( "test case order (defaults to decl)" )
|
||||
( "test case order (defaults to rand)" )
|
||||
| Opt( setRngSeed, "'time'|'random-device'|number" )
|
||||
["--rng-seed"]
|
||||
( "set a specific seed for random numbers" )
|
||||
|
||||
@@ -164,7 +164,9 @@ namespace {
|
||||
#if defined( CATCH_PLATFORM_LINUX ) \
|
||||
|| defined( CATCH_PLATFORM_MAC ) \
|
||||
|| defined( __GLIBC__ ) \
|
||||
|| defined( __FreeBSD__ ) \
|
||||
|| (defined( __FreeBSD__ ) \
|
||||
/* PlayStation platform does not have `isatty()` */ \
|
||||
&& !defined(CATCH_PLATFORM_PLAYSTATION)) \
|
||||
|| defined( CATCH_PLATFORM_QNX )
|
||||
# define CATCH_INTERNAL_HAS_ISATTY
|
||||
# include <unistd.h>
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
#ifndef CATCH_JSONWRITER_HPP_INCLUDED
|
||||
#define CATCH_JSONWRITER_HPP_INCLUDED
|
||||
|
||||
#include <catch2/internal/catch_lifetimebound.hpp>
|
||||
#include <catch2/internal/catch_reusable_string_stream.hpp>
|
||||
#include <catch2/internal/catch_stringref.hpp>
|
||||
|
||||
@@ -27,8 +28,8 @@ namespace Catch {
|
||||
|
||||
class JsonValueWriter {
|
||||
public:
|
||||
JsonValueWriter( std::ostream& os );
|
||||
JsonValueWriter( std::ostream& os, std::uint64_t indent_level );
|
||||
JsonValueWriter( std::ostream& os CATCH_ATTR_LIFETIMEBOUND );
|
||||
JsonValueWriter( std::ostream& os CATCH_ATTR_LIFETIMEBOUND, std::uint64_t indent_level );
|
||||
|
||||
JsonObjectWriter writeObject() &&;
|
||||
JsonArrayWriter writeArray() &&;
|
||||
@@ -62,8 +63,8 @@ namespace Catch {
|
||||
|
||||
class JsonObjectWriter {
|
||||
public:
|
||||
JsonObjectWriter( std::ostream& os );
|
||||
JsonObjectWriter( std::ostream& os, std::uint64_t indent_level );
|
||||
JsonObjectWriter( std::ostream& os CATCH_ATTR_LIFETIMEBOUND );
|
||||
JsonObjectWriter( std::ostream& os CATCH_ATTR_LIFETIMEBOUND, std::uint64_t indent_level );
|
||||
|
||||
JsonObjectWriter( JsonObjectWriter&& source ) noexcept;
|
||||
JsonObjectWriter& operator=( JsonObjectWriter&& source ) = delete;
|
||||
@@ -81,8 +82,8 @@ namespace Catch {
|
||||
|
||||
class JsonArrayWriter {
|
||||
public:
|
||||
JsonArrayWriter( std::ostream& os );
|
||||
JsonArrayWriter( std::ostream& os, std::uint64_t indent_level );
|
||||
JsonArrayWriter( std::ostream& os CATCH_ATTR_LIFETIMEBOUND );
|
||||
JsonArrayWriter( std::ostream& os CATCH_ATTR_LIFETIMEBOUND, std::uint64_t indent_level );
|
||||
|
||||
JsonArrayWriter( JsonArrayWriter&& source ) noexcept;
|
||||
JsonArrayWriter& operator=( JsonArrayWriter&& source ) = delete;
|
||||
|
||||
@@ -7,20 +7,24 @@
|
||||
// SPDX-License-Identifier: BSL-1.0
|
||||
|
||||
#include <catch2/internal/catch_message_info.hpp>
|
||||
#include <catch2/internal/catch_thread_local.hpp>
|
||||
|
||||
namespace Catch {
|
||||
|
||||
namespace {
|
||||
// Messages are owned by their individual threads, so the counter should
|
||||
// be thread-local as well. Alternative consideration: atomic counter,
|
||||
// so threads don't share IDs and things are easier to debug.
|
||||
static CATCH_INTERNAL_THREAD_LOCAL unsigned int messageIDCounter = 0;
|
||||
}
|
||||
|
||||
MessageInfo::MessageInfo( StringRef _macroName,
|
||||
SourceLineInfo const& _lineInfo,
|
||||
ResultWas::OfType _type )
|
||||
: macroName( _macroName ),
|
||||
lineInfo( _lineInfo ),
|
||||
type( _type ),
|
||||
sequence( ++globalCount )
|
||||
sequence( ++messageIDCounter )
|
||||
{}
|
||||
|
||||
// Messages are owned by their individual threads, so the counter should be thread-local as well.
|
||||
// Alternative consideration: atomic, so threads don't share IDs and things are easier to debug.
|
||||
thread_local unsigned int MessageInfo::globalCount = 0;
|
||||
|
||||
} // end namespace Catch
|
||||
|
||||
@@ -37,8 +37,6 @@ namespace Catch {
|
||||
bool operator < (MessageInfo const& other) const {
|
||||
return sequence < other.sequence;
|
||||
}
|
||||
private:
|
||||
static thread_local unsigned int globalCount;
|
||||
};
|
||||
|
||||
} // end namespace Catch
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
#include <catch2/internal/catch_output_redirect.hpp>
|
||||
#include <catch2/internal/catch_assertion_handler.hpp>
|
||||
#include <catch2/internal/catch_test_failure_exception.hpp>
|
||||
#include <catch2/internal/catch_thread_local.hpp>
|
||||
#include <catch2/internal/catch_result_type.hpp>
|
||||
|
||||
#include <cassert>
|
||||
@@ -173,27 +174,40 @@ namespace Catch {
|
||||
// should also be thread local. For now we just use naked globals
|
||||
// below, in the future we will want to allocate piece of memory
|
||||
// from heap, to avoid consuming too much thread-local storage.
|
||||
//
|
||||
// Note that we also don't want non-trivial the thread-local variables
|
||||
// below be initialized for every thread, only for those that touch
|
||||
// Catch2. To make this work with both GCC/Clang and MSVC, we have to
|
||||
// make them thread-local magic statics. (Class-level statics have the
|
||||
// desired semantics on GCC, but not on MSVC).
|
||||
|
||||
// This is used for the "if" part of CHECKED_IF/CHECKED_ELSE
|
||||
static thread_local bool g_lastAssertionPassed = false;
|
||||
static CATCH_INTERNAL_THREAD_LOCAL bool g_lastAssertionPassed = false;
|
||||
|
||||
// This is the source location for last encountered macro. It is
|
||||
// used to provide the users with more precise location of error
|
||||
// when an unexpected exception/fatal error happens.
|
||||
static thread_local SourceLineInfo g_lastKnownLineInfo("DummyLocation", static_cast<size_t>(-1));
|
||||
static CATCH_INTERNAL_THREAD_LOCAL SourceLineInfo
|
||||
g_lastKnownLineInfo( "DummyLocation", static_cast<size_t>( -1 ) );
|
||||
|
||||
// Should we clear message scopes before sending off the messages to
|
||||
// reporter? Set in `assertionPassedFastPath` to avoid doing the full
|
||||
// clear there for performance reasons.
|
||||
static thread_local bool g_clearMessageScopes = false;
|
||||
static CATCH_INTERNAL_THREAD_LOCAL bool g_clearMessageScopes = false;
|
||||
|
||||
CATCH_INTERNAL_START_WARNINGS_SUPPRESSION
|
||||
CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS
|
||||
// Actual messages to be provided to the reporter
|
||||
static thread_local std::vector<MessageInfo> g_messages;
|
||||
static std::vector<MessageInfo>& g_messages() {
|
||||
static CATCH_INTERNAL_THREAD_LOCAL std::vector<MessageInfo> value;
|
||||
return value;
|
||||
}
|
||||
|
||||
// Owners for the UNSCOPED_X information macro
|
||||
static thread_local std::vector<ScopedMessage> g_messageScopes;
|
||||
static std::vector<ScopedMessage>& g_messageScopes() {
|
||||
static CATCH_INTERNAL_THREAD_LOCAL std::vector<ScopedMessage> value;
|
||||
return value;
|
||||
}
|
||||
CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION
|
||||
|
||||
} // namespace Detail
|
||||
@@ -210,6 +224,13 @@ namespace Catch {
|
||||
{
|
||||
getCurrentMutableContext().setResultCapture( this );
|
||||
m_reporter->testRunStarting(m_runInfo);
|
||||
|
||||
// TODO: HACK!
|
||||
// We need to make sure the underlying cache is initialized
|
||||
// while we are guaranteed to be running in a single thread,
|
||||
// because the initialization is not thread-safe.
|
||||
ReusableStringStream rss;
|
||||
(void)rss;
|
||||
}
|
||||
|
||||
RunContext::~RunContext() {
|
||||
@@ -333,7 +354,7 @@ namespace Catch {
|
||||
}
|
||||
|
||||
if ( Detail::g_clearMessageScopes ) {
|
||||
Detail::g_messageScopes.clear();
|
||||
Detail::g_messageScopes().clear();
|
||||
Detail::g_clearMessageScopes = false;
|
||||
}
|
||||
|
||||
@@ -342,11 +363,11 @@ namespace Catch {
|
||||
{
|
||||
auto _ = scopedDeactivate( *m_outputRedirect );
|
||||
updateTotalsFromAtomics();
|
||||
m_reporter->assertionEnded( AssertionStats( result, Detail::g_messages, m_totals ) );
|
||||
m_reporter->assertionEnded( AssertionStats( result, Detail::g_messages(), m_totals ) );
|
||||
}
|
||||
|
||||
if ( result.getResultType() != ResultWas::Warning ) {
|
||||
Detail::g_messageScopes.clear();
|
||||
Detail::g_messageScopes().clear();
|
||||
}
|
||||
|
||||
// Reset working state. assertion info will be reset after
|
||||
@@ -635,10 +656,10 @@ namespace Catch {
|
||||
|
||||
m_testCaseTracker->close();
|
||||
handleUnfinishedSections();
|
||||
Detail::g_messageScopes.clear();
|
||||
Detail::g_messageScopes().clear();
|
||||
// TBD: At this point, m_messages should be empty. Do we want to
|
||||
// assert that this is true, or keep the defensive clear call?
|
||||
Detail::g_messages.clear();
|
||||
Detail::g_messages().clear();
|
||||
|
||||
SectionStats testCaseSectionStats(CATCH_MOVE(testCaseSection), assertions, duration, missingAssertions);
|
||||
m_reporter->sectionEnded(testCaseSectionStats);
|
||||
@@ -806,7 +827,7 @@ namespace Catch {
|
||||
}
|
||||
|
||||
void IResultCapture::pushScopedMessage( MessageInfo&& message ) {
|
||||
Detail::g_messages.push_back( CATCH_MOVE( message ) );
|
||||
Detail::g_messages().push_back( CATCH_MOVE( message ) );
|
||||
}
|
||||
|
||||
void IResultCapture::popScopedMessage( unsigned int messageId ) {
|
||||
@@ -815,16 +836,25 @@ namespace Catch {
|
||||
// messages than low single digits, so the optimization is tiny,
|
||||
// and we would have to hand-write the loop to avoid terrible
|
||||
// codegen of reverse iterators in debug mode.
|
||||
Detail::g_messages.erase( std::find_if( Detail::g_messages.begin(),
|
||||
Detail::g_messages.end(),
|
||||
[=]( MessageInfo const& msg ) {
|
||||
return msg.sequence ==
|
||||
messageId;
|
||||
} ) );
|
||||
auto& messages = Detail::g_messages();
|
||||
messages.erase( std::find_if( messages.begin(),
|
||||
messages.end(),
|
||||
[=]( MessageInfo const& msg ) {
|
||||
return msg.sequence ==
|
||||
messageId;
|
||||
} ) );
|
||||
}
|
||||
|
||||
void IResultCapture::emplaceUnscopedMessage( MessageBuilder&& builder ) {
|
||||
Detail::g_messageScopes.emplace_back( CATCH_MOVE( builder ) );
|
||||
// Invalid unscoped messages are lazy cleared. If we have any,
|
||||
// we have to get rid of them before adding new ones, or the
|
||||
// delayed clear in assertion handling will erase the valid ones
|
||||
// as well.
|
||||
if ( Detail::g_clearMessageScopes ) {
|
||||
Detail::g_messageScopes().clear();
|
||||
Detail::g_clearMessageScopes = false;
|
||||
}
|
||||
Detail::g_messageScopes().emplace_back( CATCH_MOVE( builder ) );
|
||||
}
|
||||
|
||||
void seedRng(IConfig const& config) {
|
||||
|
||||
19
src/catch2/internal/catch_thread_local.hpp
Normal file
19
src/catch2/internal/catch_thread_local.hpp
Normal file
@@ -0,0 +1,19 @@
|
||||
|
||||
// Copyright Catch2 Authors
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE.txt or copy at
|
||||
// https://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// SPDX-License-Identifier: BSL-1.0
|
||||
#ifndef CATCH_THREAD_LOCAL_HPP_INCLUDED
|
||||
#define CATCH_THREAD_LOCAL_HPP_INCLUDED
|
||||
|
||||
#include <catch2/catch_user_config.hpp>
|
||||
|
||||
#if defined( CATCH_CONFIG_EXPERIMENTAL_THREAD_SAFE_ASSERTIONS )
|
||||
#define CATCH_INTERNAL_THREAD_LOCAL thread_local
|
||||
#else
|
||||
#define CATCH_INTERNAL_THREAD_LOCAL
|
||||
#endif
|
||||
|
||||
#endif // CATCH_THREAD_LOCAL_HPP_INCLUDED
|
||||
@@ -23,10 +23,10 @@ namespace Catch {
|
||||
using Mutex = std::mutex;
|
||||
using LockGuard = std::lock_guard<std::mutex>;
|
||||
struct AtomicCounts {
|
||||
std::atomic<std::uint64_t> passed = 0;
|
||||
std::atomic<std::uint64_t> failed = 0;
|
||||
std::atomic<std::uint64_t> failedButOk = 0;
|
||||
std::atomic<std::uint64_t> skipped = 0;
|
||||
std::atomic<std::uint64_t> passed{ 0 };
|
||||
std::atomic<std::uint64_t> failed{ 0 };
|
||||
std::atomic<std::uint64_t> failedButOk{ 0 };
|
||||
std::atomic<std::uint64_t> skipped{ 0 };
|
||||
};
|
||||
#else // ^^ Use actual mutex, lock and atomics
|
||||
// vv Dummy implementations for single-thread performance
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
#ifndef CATCH_XMLWRITER_HPP_INCLUDED
|
||||
#define CATCH_XMLWRITER_HPP_INCLUDED
|
||||
|
||||
#include <catch2/internal/catch_lifetimebound.hpp>
|
||||
#include <catch2/internal/catch_reusable_string_stream.hpp>
|
||||
#include <catch2/internal/catch_stringref.hpp>
|
||||
|
||||
@@ -43,7 +44,7 @@ namespace Catch {
|
||||
public:
|
||||
enum ForWhat { ForTextNodes, ForAttributes };
|
||||
|
||||
constexpr XmlEncode( StringRef str, ForWhat forWhat = ForTextNodes ):
|
||||
constexpr XmlEncode( StringRef str CATCH_ATTR_LIFETIMEBOUND, ForWhat forWhat = ForTextNodes ):
|
||||
m_str( str ), m_forWhat( forWhat ) {}
|
||||
|
||||
|
||||
@@ -61,7 +62,7 @@ namespace Catch {
|
||||
|
||||
class ScopedElement {
|
||||
public:
|
||||
ScopedElement( XmlWriter* writer, XmlFormatting fmt );
|
||||
ScopedElement( XmlWriter* writer CATCH_ATTR_LIFETIMEBOUND, XmlFormatting fmt );
|
||||
|
||||
ScopedElement( ScopedElement&& other ) noexcept;
|
||||
ScopedElement& operator=( ScopedElement&& other ) noexcept;
|
||||
@@ -93,7 +94,7 @@ namespace Catch {
|
||||
XmlFormatting m_fmt;
|
||||
};
|
||||
|
||||
XmlWriter( std::ostream& os );
|
||||
XmlWriter( std::ostream& os CATCH_ATTR_LIFETIMEBOUND );
|
||||
~XmlWriter();
|
||||
|
||||
XmlWriter( XmlWriter const& ) = delete;
|
||||
|
||||
@@ -148,6 +148,7 @@ internal_headers = [
|
||||
'internal/catch_test_registry.hpp',
|
||||
'internal/catch_test_spec_parser.hpp',
|
||||
'internal/catch_textflow.hpp',
|
||||
'internal/catch_thread_local.hpp',
|
||||
'internal/catch_thread_support.hpp',
|
||||
'internal/catch_to_string.hpp',
|
||||
'internal/catch_uncaught_exceptions.hpp',
|
||||
|
||||
@@ -177,6 +177,18 @@ set_tests_properties(DeferredStaticChecks
|
||||
PASS_REGULAR_EXPRESSION "test cases: 1 \\| 1 failed\nassertions: 3 \\| 3 failed"
|
||||
)
|
||||
|
||||
add_executable(MixingClearedAndUnclearedMessages ${TESTS_DIR}/X06-MixingClearedAndUnclearedMessages.cpp)
|
||||
target_link_libraries(MixingClearedAndUnclearedMessages PRIVATE Catch2WithMain)
|
||||
|
||||
add_test(NAME MixingClearedAndUnclearedMessages
|
||||
COMMAND
|
||||
MixingClearedAndUnclearedMessages
|
||||
-r compact)
|
||||
set_tests_properties(MixingClearedAndUnclearedMessages
|
||||
PROPERTIES
|
||||
PASS_REGULAR_EXPRESSION ": false with 1 message: 'b'"
|
||||
)
|
||||
|
||||
add_executable(FallbackStringifier ${TESTS_DIR}/X10-FallbackStringifier.cpp)
|
||||
target_compile_definitions(FallbackStringifier PRIVATE CATCH_CONFIG_FALLBACK_STRINGIFIER=fallbackStringifier)
|
||||
target_link_libraries(FallbackStringifier Catch2WithMain)
|
||||
@@ -528,6 +540,7 @@ set(EXTRA_TEST_BINARIES
|
||||
DuplicatedTestCases-DuplicatedTestCaseMethods
|
||||
NoTests
|
||||
ListenersGetEventsBeforeReporters
|
||||
MixingClearedAndUnclearedMessages
|
||||
# DebugBreakMacros
|
||||
)
|
||||
|
||||
@@ -553,3 +566,17 @@ set_tests_properties(AmalgamatedFileTest
|
||||
PROPERTIES
|
||||
PASS_REGULAR_EXPRESSION "All tests passed \\(14 assertions in 3 test cases\\)"
|
||||
)
|
||||
|
||||
add_executable(ThreadSafetyTests
|
||||
${TESTS_DIR}/X94-ThreadSafetyTests.cpp
|
||||
)
|
||||
target_link_libraries(ThreadSafetyTests Catch2_buildall_interface)
|
||||
target_compile_definitions(ThreadSafetyTests PUBLIC CATCH_CONFIG_EXPERIMENTAL_THREAD_SAFE_ASSERTIONS)
|
||||
add_test(NAME ThreadSafetyTests
|
||||
COMMAND ThreadSafetyTests -r compact "Failed REQUIRE in the main thread is fine"
|
||||
)
|
||||
set_tests_properties(ThreadSafetyTests
|
||||
PROPERTIES
|
||||
PASS_REGULAR_EXPRESSION "assertions: 801 | 400 passed | 401 failed"
|
||||
RUN_SERIAL ON
|
||||
)
|
||||
|
||||
27
tests/ExtraTests/X06-MixingClearedAndUnclearedMessages.cpp
Normal file
27
tests/ExtraTests/X06-MixingClearedAndUnclearedMessages.cpp
Normal file
@@ -0,0 +1,27 @@
|
||||
|
||||
// Copyright Catch2 Authors
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE.txt or copy at
|
||||
// https://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// SPDX-License-Identifier: BSL-1.0
|
||||
|
||||
/**\file
|
||||
* Checks that when we use up an unscoped message (e.g. `UNSCOPED_INFO`),
|
||||
* with an assertion, and then add another message later, it will be
|
||||
* properly reported with later failing assertion.
|
||||
*
|
||||
* This needs separate binary to avoid the main test binary's validating
|
||||
* listener, which disables the assertion fast path.
|
||||
*/
|
||||
|
||||
#include <catch2/catch_test_macros.hpp>
|
||||
|
||||
TEST_CASE(
|
||||
"Delayed unscoped message clearing does not catch newly inserted messages",
|
||||
"[messages][unscoped][!shouldfail]" ) {
|
||||
UNSCOPED_INFO( "a" );
|
||||
REQUIRE( true );
|
||||
UNSCOPED_INFO( "b" );
|
||||
REQUIRE( false );
|
||||
}
|
||||
43
tests/ExtraTests/X94-ThreadSafetyTests.cpp
Normal file
43
tests/ExtraTests/X94-ThreadSafetyTests.cpp
Normal file
@@ -0,0 +1,43 @@
|
||||
|
||||
// Copyright Catch2 Authors
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE.txt or copy at
|
||||
// https://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// SPDX-License-Identifier: BSL-1.0
|
||||
|
||||
/**\file
|
||||
* Test that assertions and messages are thread-safe.
|
||||
*
|
||||
* This is done by spamming assertions and messages on multiple subthreads.
|
||||
* In manual, this reliably causes segfaults if the test is linked against
|
||||
* a non-thread-safe version of Catch2.
|
||||
*
|
||||
* The CTest test definition should also verify that the final assertion
|
||||
* count is correct.
|
||||
*/
|
||||
|
||||
#include <catch2/catch_test_macros.hpp>
|
||||
|
||||
#include <thread>
|
||||
#include <vector>
|
||||
|
||||
TEST_CASE( "Failed REQUIRE in the main thread is fine", "[!shouldfail]" ) {
|
||||
std::vector<std::thread> threads;
|
||||
for ( size_t t = 0; t < 4; ++t) {
|
||||
threads.emplace_back( [t]() {
|
||||
CAPTURE(t);
|
||||
for (size_t i = 0; i < 100; ++i) {
|
||||
CAPTURE(i);
|
||||
CHECK( false );
|
||||
CHECK( true );
|
||||
}
|
||||
} );
|
||||
}
|
||||
|
||||
for (auto& t : threads) {
|
||||
t.join();
|
||||
}
|
||||
|
||||
REQUIRE( false );
|
||||
}
|
||||
@@ -138,6 +138,7 @@ Nor would this
|
||||
:test-result: FAIL Custom exceptions can be translated when testing for throwing as something else
|
||||
:test-result: FAIL Custom std-exceptions can be custom translated
|
||||
:test-result: PASS Default scale is invisible to comparison
|
||||
:test-result: XFAIL Delayed unscoped message clearing does not catch newly inserted messages
|
||||
:test-result: PASS Directly creating an EnumInfo
|
||||
:test-result: SKIP Empty generators can SKIP in constructor
|
||||
:test-result: PASS Empty stream name opens cout stream
|
||||
|
||||
@@ -136,6 +136,7 @@
|
||||
:test-result: FAIL Custom exceptions can be translated when testing for throwing as something else
|
||||
:test-result: FAIL Custom std-exceptions can be custom translated
|
||||
:test-result: PASS Default scale is invisible to comparison
|
||||
:test-result: XFAIL Delayed unscoped message clearing does not catch newly inserted messages
|
||||
:test-result: PASS Directly creating an EnumInfo
|
||||
:test-result: SKIP Empty generators can SKIP in constructor
|
||||
:test-result: PASS Empty stream name opens cout stream
|
||||
|
||||
@@ -562,6 +562,8 @@ Exception.tests.cpp:<line number>: failed: unexpected exception with message: 'c
|
||||
Exception.tests.cpp:<line number>: failed: unexpected exception with message: 'custom std exception'
|
||||
Approx.tests.cpp:<line number>: passed: 101.000001 != Approx(100).epsilon(0.01) for: 101.00000099999999748 != Approx( 100.0 )
|
||||
Approx.tests.cpp:<line number>: passed: std::pow(10, -5) != Approx(std::pow(10, -7)) for: 0.00001 != Approx( 0.0000001 )
|
||||
Message.tests.cpp:<line number>: passed: true with 1 message: 'a'
|
||||
Message.tests.cpp:<line number>: failed: false with 1 message: 'b'
|
||||
ToString.tests.cpp:<line number>: passed: enumInfo->lookup(0) == "Value1" for: Value1 == "Value1"
|
||||
ToString.tests.cpp:<line number>: passed: enumInfo->lookup(1) == "Value2" for: Value2 == "Value2"
|
||||
ToString.tests.cpp:<line number>: passed: enumInfo->lookup(3) == "{** unexpected enum value **}" for: {** unexpected enum value **}
|
||||
@@ -2888,7 +2890,7 @@ InternalBenchmark.tests.cpp:<line number>: passed: med == 18. for: 18.0 == 18.0
|
||||
InternalBenchmark.tests.cpp:<line number>: passed: q3 == 23. for: 23.0 == 23.0
|
||||
Misc.tests.cpp:<line number>: passed:
|
||||
Misc.tests.cpp:<line number>: passed:
|
||||
test cases: 435 | 317 passed | 95 failed | 6 skipped | 17 failed as expected
|
||||
assertions: 2303 | 2105 passed | 157 failed | 41 failed as expected
|
||||
test cases: 436 | 317 passed | 95 failed | 6 skipped | 18 failed as expected
|
||||
assertions: 2305 | 2106 passed | 157 failed | 42 failed as expected
|
||||
|
||||
|
||||
|
||||
@@ -560,6 +560,8 @@ Exception.tests.cpp:<line number>: failed: unexpected exception with message: 'c
|
||||
Exception.tests.cpp:<line number>: failed: unexpected exception with message: 'custom std exception'
|
||||
Approx.tests.cpp:<line number>: passed: 101.000001 != Approx(100).epsilon(0.01) for: 101.00000099999999748 != Approx( 100.0 )
|
||||
Approx.tests.cpp:<line number>: passed: std::pow(10, -5) != Approx(std::pow(10, -7)) for: 0.00001 != Approx( 0.0000001 )
|
||||
Message.tests.cpp:<line number>: passed: true with 1 message: 'a'
|
||||
Message.tests.cpp:<line number>: failed: false with 1 message: 'b'
|
||||
ToString.tests.cpp:<line number>: passed: enumInfo->lookup(0) == "Value1" for: Value1 == "Value1"
|
||||
ToString.tests.cpp:<line number>: passed: enumInfo->lookup(1) == "Value2" for: Value2 == "Value2"
|
||||
ToString.tests.cpp:<line number>: passed: enumInfo->lookup(3) == "{** unexpected enum value **}" for: {** unexpected enum value **}
|
||||
@@ -2877,7 +2879,7 @@ InternalBenchmark.tests.cpp:<line number>: passed: med == 18. for: 18.0 == 18.0
|
||||
InternalBenchmark.tests.cpp:<line number>: passed: q3 == 23. for: 23.0 == 23.0
|
||||
Misc.tests.cpp:<line number>: passed:
|
||||
Misc.tests.cpp:<line number>: passed:
|
||||
test cases: 435 | 317 passed | 95 failed | 6 skipped | 17 failed as expected
|
||||
assertions: 2303 | 2105 passed | 157 failed | 41 failed as expected
|
||||
test cases: 436 | 317 passed | 95 failed | 6 skipped | 18 failed as expected
|
||||
assertions: 2305 | 2106 passed | 157 failed | 42 failed as expected
|
||||
|
||||
|
||||
|
||||
@@ -450,6 +450,17 @@ Exception.tests.cpp:<line number>: FAILED:
|
||||
due to unexpected exception with message:
|
||||
custom std exception
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
Delayed unscoped message clearing does not catch newly inserted messages
|
||||
-------------------------------------------------------------------------------
|
||||
Message.tests.cpp:<line number>
|
||||
...............................................................................
|
||||
|
||||
Message.tests.cpp:<line number>: FAILED:
|
||||
REQUIRE( false )
|
||||
with message:
|
||||
b
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
Empty generators can SKIP in constructor
|
||||
-------------------------------------------------------------------------------
|
||||
@@ -1719,6 +1730,6 @@ due to unexpected exception with message:
|
||||
Why would you throw a std::string?
|
||||
|
||||
===============================================================================
|
||||
test cases: 435 | 335 passed | 76 failed | 7 skipped | 17 failed as expected
|
||||
assertions: 2282 | 2105 passed | 136 failed | 41 failed as expected
|
||||
test cases: 436 | 335 passed | 76 failed | 7 skipped | 18 failed as expected
|
||||
assertions: 2284 | 2106 passed | 136 failed | 42 failed as expected
|
||||
|
||||
|
||||
@@ -4148,6 +4148,22 @@ Approx.tests.cpp:<line number>: PASSED:
|
||||
with expansion:
|
||||
0.00001 != Approx( 0.0000001 )
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
Delayed unscoped message clearing does not catch newly inserted messages
|
||||
-------------------------------------------------------------------------------
|
||||
Message.tests.cpp:<line number>
|
||||
...............................................................................
|
||||
|
||||
Message.tests.cpp:<line number>: PASSED:
|
||||
REQUIRE( true )
|
||||
with message:
|
||||
a
|
||||
|
||||
Message.tests.cpp:<line number>: FAILED:
|
||||
REQUIRE( false )
|
||||
with message:
|
||||
b
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
Directly creating an EnumInfo
|
||||
-------------------------------------------------------------------------------
|
||||
@@ -19295,6 +19311,6 @@ Misc.tests.cpp:<line number>
|
||||
Misc.tests.cpp:<line number>: PASSED:
|
||||
|
||||
===============================================================================
|
||||
test cases: 435 | 317 passed | 95 failed | 6 skipped | 17 failed as expected
|
||||
assertions: 2303 | 2105 passed | 157 failed | 41 failed as expected
|
||||
test cases: 436 | 317 passed | 95 failed | 6 skipped | 18 failed as expected
|
||||
assertions: 2305 | 2106 passed | 157 failed | 42 failed as expected
|
||||
|
||||
|
||||
@@ -4146,6 +4146,22 @@ Approx.tests.cpp:<line number>: PASSED:
|
||||
with expansion:
|
||||
0.00001 != Approx( 0.0000001 )
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
Delayed unscoped message clearing does not catch newly inserted messages
|
||||
-------------------------------------------------------------------------------
|
||||
Message.tests.cpp:<line number>
|
||||
...............................................................................
|
||||
|
||||
Message.tests.cpp:<line number>: PASSED:
|
||||
REQUIRE( true )
|
||||
with message:
|
||||
a
|
||||
|
||||
Message.tests.cpp:<line number>: FAILED:
|
||||
REQUIRE( false )
|
||||
with message:
|
||||
b
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
Directly creating an EnumInfo
|
||||
-------------------------------------------------------------------------------
|
||||
@@ -19284,6 +19300,6 @@ Misc.tests.cpp:<line number>
|
||||
Misc.tests.cpp:<line number>: PASSED:
|
||||
|
||||
===============================================================================
|
||||
test cases: 435 | 317 passed | 95 failed | 6 skipped | 17 failed as expected
|
||||
assertions: 2303 | 2105 passed | 157 failed | 41 failed as expected
|
||||
test cases: 436 | 317 passed | 95 failed | 6 skipped | 18 failed as expected
|
||||
assertions: 2305 | 2106 passed | 157 failed | 42 failed as expected
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<testsuitesloose text artifact
|
||||
>
|
||||
<testsuite name="<exe-name>" errors="17" failures="140" skipped="12" tests="2315" hostname="tbd" time="{duration}" timestamp="{iso8601-timestamp}">
|
||||
<testsuite name="<exe-name>" errors="17" failures="140" skipped="12" tests="2317" hostname="tbd" time="{duration}" timestamp="{iso8601-timestamp}">
|
||||
<properties>
|
||||
<property name="random-seed" value="1"/>
|
||||
<property name="filters" value=""*" ~[!nonportable] ~[!benchmark] ~[approvals]"/>
|
||||
@@ -547,6 +547,15 @@ at Exception.tests.cpp:<line number>
|
||||
</error>
|
||||
</testcase>
|
||||
<testcase classname="<exe-name>.global" name="Default scale is invisible to comparison" time="{duration}" status="run"/>
|
||||
<testcase classname="<exe-name>.global" name="Delayed unscoped message clearing does not catch newly inserted messages" time="{duration}" status="run">
|
||||
<skipped message="TEST_CASE tagged with !mayfail"/>
|
||||
<failure message="false" type="REQUIRE">
|
||||
FAILED:
|
||||
REQUIRE( false )
|
||||
b
|
||||
at Message.tests.cpp:<line number>
|
||||
</failure>
|
||||
</testcase>
|
||||
<testcase classname="<exe-name>.global" name="Directly creating an EnumInfo" time="{duration}" status="run"/>
|
||||
<testcase classname="<exe-name>.global" name="Empty generators can SKIP in constructor" time="{duration}" status="run">
|
||||
<skipped type="SKIP">
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<testsuites>
|
||||
<testsuite name="<exe-name>" errors="17" failures="140" skipped="12" tests="2315" hostname="tbd" time="{duration}" timestamp="{iso8601-timestamp}">
|
||||
<testsuite name="<exe-name>" errors="17" failures="140" skipped="12" tests="2317" hostname="tbd" time="{duration}" timestamp="{iso8601-timestamp}">
|
||||
<properties>
|
||||
<property name="random-seed" value="1"/>
|
||||
<property name="filters" value=""*" ~[!nonportable] ~[!benchmark] ~[approvals]"/>
|
||||
@@ -546,6 +546,15 @@ at Exception.tests.cpp:<line number>
|
||||
</error>
|
||||
</testcase>
|
||||
<testcase classname="<exe-name>.global" name="Default scale is invisible to comparison" time="{duration}" status="run"/>
|
||||
<testcase classname="<exe-name>.global" name="Delayed unscoped message clearing does not catch newly inserted messages" time="{duration}" status="run">
|
||||
<skipped message="TEST_CASE tagged with !mayfail"/>
|
||||
<failure message="false" type="REQUIRE">
|
||||
FAILED:
|
||||
REQUIRE( false )
|
||||
b
|
||||
at Message.tests.cpp:<line number>
|
||||
</failure>
|
||||
</testcase>
|
||||
<testcase classname="<exe-name>.global" name="Directly creating an EnumInfo" time="{duration}" status="run"/>
|
||||
<testcase classname="<exe-name>.global" name="Empty generators can SKIP in constructor" time="{duration}" status="run">
|
||||
<skipped type="SKIP">
|
||||
|
||||
@@ -1699,6 +1699,14 @@ at Message.tests.cpp:<line number>
|
||||
</failure>
|
||||
</testCase>
|
||||
<testCase name="Captures outlive section end/Dummy section" duration="{duration}"/>
|
||||
<testCase name="Delayed unscoped message clearing does not catch newly inserted messages" duration="{duration}">
|
||||
<skipped message="REQUIRE(false)">
|
||||
FAILED:
|
||||
REQUIRE( false )
|
||||
b
|
||||
at Message.tests.cpp:<line number>
|
||||
</skipped>
|
||||
</testCase>
|
||||
<testCase name="FAIL aborts the test" duration="{duration}">
|
||||
<failure message="FAIL()">
|
||||
FAILED:
|
||||
|
||||
@@ -1698,6 +1698,14 @@ at Message.tests.cpp:<line number>
|
||||
</failure>
|
||||
</testCase>
|
||||
<testCase name="Captures outlive section end/Dummy section" duration="{duration}"/>
|
||||
<testCase name="Delayed unscoped message clearing does not catch newly inserted messages" duration="{duration}">
|
||||
<skipped message="REQUIRE(false)">
|
||||
FAILED:
|
||||
REQUIRE( false )
|
||||
b
|
||||
at Message.tests.cpp:<line number>
|
||||
</skipped>
|
||||
</testCase>
|
||||
<testCase name="FAIL aborts the test" duration="{duration}">
|
||||
<failure message="FAIL()">
|
||||
FAILED:
|
||||
|
||||
@@ -1024,6 +1024,10 @@ not ok {test-number} - unexpected exception with message: 'custom std exception'
|
||||
ok {test-number} - 101.000001 != Approx(100).epsilon(0.01) for: 101.00000099999999748 != Approx( 100.0 )
|
||||
# Default scale is invisible to comparison
|
||||
ok {test-number} - std::pow(10, -5) != Approx(std::pow(10, -7)) for: 0.00001 != Approx( 0.0000001 )
|
||||
# Delayed unscoped message clearing does not catch newly inserted messages
|
||||
ok {test-number} - true with 1 message: 'a'
|
||||
# Delayed unscoped message clearing does not catch newly inserted messages
|
||||
not ok {test-number} - false with 1 message: 'b'
|
||||
# Directly creating an EnumInfo
|
||||
ok {test-number} - enumInfo->lookup(0) == "Value1" for: Value1 == "Value1"
|
||||
# Directly creating an EnumInfo
|
||||
@@ -4627,5 +4631,5 @@ ok {test-number} - q3 == 23. for: 23.0 == 23.0
|
||||
ok {test-number} -
|
||||
# xmlentitycheck
|
||||
ok {test-number} -
|
||||
1..2315
|
||||
1..2317
|
||||
|
||||
|
||||
@@ -1022,6 +1022,10 @@ not ok {test-number} - unexpected exception with message: 'custom std exception'
|
||||
ok {test-number} - 101.000001 != Approx(100).epsilon(0.01) for: 101.00000099999999748 != Approx( 100.0 )
|
||||
# Default scale is invisible to comparison
|
||||
ok {test-number} - std::pow(10, -5) != Approx(std::pow(10, -7)) for: 0.00001 != Approx( 0.0000001 )
|
||||
# Delayed unscoped message clearing does not catch newly inserted messages
|
||||
ok {test-number} - true with 1 message: 'a'
|
||||
# Delayed unscoped message clearing does not catch newly inserted messages
|
||||
not ok {test-number} - false with 1 message: 'b'
|
||||
# Directly creating an EnumInfo
|
||||
ok {test-number} - enumInfo->lookup(0) == "Value1" for: Value1 == "Value1"
|
||||
# Directly creating an EnumInfo
|
||||
@@ -4616,5 +4620,5 @@ ok {test-number} - q3 == 23. for: 23.0 == 23.0
|
||||
ok {test-number} -
|
||||
# xmlentitycheck
|
||||
ok {test-number} -
|
||||
1..2315
|
||||
1..2317
|
||||
|
||||
|
||||
@@ -322,6 +322,9 @@
|
||||
##teamcity[testFinished name='Custom std-exceptions can be custom translated' duration="{duration}"]
|
||||
##teamcity[testStarted name='Default scale is invisible to comparison']
|
||||
##teamcity[testFinished name='Default scale is invisible to comparison' duration="{duration}"]
|
||||
##teamcity[testStarted name='Delayed unscoped message clearing does not catch newly inserted messages']
|
||||
##teamcity[testIgnored name='Delayed unscoped message clearing does not catch newly inserted messages' message='Message.tests.cpp:<line number>|n...............................................................................|n|nMessage.tests.cpp:<line number>|nexpression failed with message:|n "b"|n REQUIRE( false )|nwith expansion:|n false|n- failure ignore as test marked as |'ok to fail|'|n']
|
||||
##teamcity[testFinished name='Delayed unscoped message clearing does not catch newly inserted messages' duration="{duration}"]
|
||||
##teamcity[testStarted name='Directly creating an EnumInfo']
|
||||
##teamcity[testFinished name='Directly creating an EnumInfo' duration="{duration}"]
|
||||
##teamcity[testStarted name='Empty generators can SKIP in constructor']
|
||||
|
||||
@@ -322,6 +322,9 @@
|
||||
##teamcity[testFinished name='Custom std-exceptions can be custom translated' duration="{duration}"]
|
||||
##teamcity[testStarted name='Default scale is invisible to comparison']
|
||||
##teamcity[testFinished name='Default scale is invisible to comparison' duration="{duration}"]
|
||||
##teamcity[testStarted name='Delayed unscoped message clearing does not catch newly inserted messages']
|
||||
##teamcity[testIgnored name='Delayed unscoped message clearing does not catch newly inserted messages' message='Message.tests.cpp:<line number>|n...............................................................................|n|nMessage.tests.cpp:<line number>|nexpression failed with message:|n "b"|n REQUIRE( false )|nwith expansion:|n false|n- failure ignore as test marked as |'ok to fail|'|n']
|
||||
##teamcity[testFinished name='Delayed unscoped message clearing does not catch newly inserted messages' duration="{duration}"]
|
||||
##teamcity[testStarted name='Directly creating an EnumInfo']
|
||||
##teamcity[testFinished name='Directly creating an EnumInfo' duration="{duration}"]
|
||||
##teamcity[testStarted name='Empty generators can SKIP in constructor']
|
||||
|
||||
@@ -4613,6 +4613,31 @@ C
|
||||
</Expression>
|
||||
<OverallResult success="true" skips="0"/>
|
||||
</TestCase>
|
||||
<TestCase name="Delayed unscoped message clearing does not catch newly inserted messages" tags="[!shouldfail][messages][unscoped]" filename="tests/<exe-name>/UsageTests/Message.tests.cpp" >
|
||||
<Info filename="tests/<exe-name>/UsageTests/Message.tests.cpp" >
|
||||
a
|
||||
</Info>
|
||||
<Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Message.tests.cpp" >
|
||||
<Original>
|
||||
true
|
||||
</Original>
|
||||
<Expanded>
|
||||
true
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<Info filename="tests/<exe-name>/UsageTests/Message.tests.cpp" >
|
||||
b
|
||||
</Info>
|
||||
<Expression success="false" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Message.tests.cpp" >
|
||||
<Original>
|
||||
false
|
||||
</Original>
|
||||
<Expanded>
|
||||
false
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<OverallResult success="true" skips="0"/>
|
||||
</TestCase>
|
||||
<TestCase name="Directly creating an EnumInfo" filename="tests/<exe-name>/IntrospectiveTests/ToString.tests.cpp" >
|
||||
<Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/ToString.tests.cpp" >
|
||||
<Original>
|
||||
@@ -22324,6 +22349,6 @@ Approx( -1.95996398454005449 )
|
||||
</Section>
|
||||
<OverallResult success="true" skips="0"/>
|
||||
</TestCase>
|
||||
<OverallResults successes="2105" failures="157" expectedFailures="41" skips="12"/>
|
||||
<OverallResultsCases successes="317" failures="95" expectedFailures="17" skips="6"/>
|
||||
<OverallResults successes="2106" failures="157" expectedFailures="42" skips="12"/>
|
||||
<OverallResultsCases successes="317" failures="95" expectedFailures="18" skips="6"/>
|
||||
</Catch2TestRun>
|
||||
|
||||
@@ -4613,6 +4613,31 @@ C
|
||||
</Expression>
|
||||
<OverallResult success="true" skips="0"/>
|
||||
</TestCase>
|
||||
<TestCase name="Delayed unscoped message clearing does not catch newly inserted messages" tags="[!shouldfail][messages][unscoped]" filename="tests/<exe-name>/UsageTests/Message.tests.cpp" >
|
||||
<Info filename="tests/<exe-name>/UsageTests/Message.tests.cpp" >
|
||||
a
|
||||
</Info>
|
||||
<Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Message.tests.cpp" >
|
||||
<Original>
|
||||
true
|
||||
</Original>
|
||||
<Expanded>
|
||||
true
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<Info filename="tests/<exe-name>/UsageTests/Message.tests.cpp" >
|
||||
b
|
||||
</Info>
|
||||
<Expression success="false" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Message.tests.cpp" >
|
||||
<Original>
|
||||
false
|
||||
</Original>
|
||||
<Expanded>
|
||||
false
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<OverallResult success="true" skips="0"/>
|
||||
</TestCase>
|
||||
<TestCase name="Directly creating an EnumInfo" filename="tests/<exe-name>/IntrospectiveTests/ToString.tests.cpp" >
|
||||
<Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/ToString.tests.cpp" >
|
||||
<Original>
|
||||
@@ -22323,6 +22348,6 @@ Approx( -1.95996398454005449 )
|
||||
</Section>
|
||||
<OverallResult success="true" skips="0"/>
|
||||
</TestCase>
|
||||
<OverallResults successes="2105" failures="157" expectedFailures="41" skips="12"/>
|
||||
<OverallResultsCases successes="317" failures="95" expectedFailures="17" skips="6"/>
|
||||
<OverallResults successes="2106" failures="157" expectedFailures="42" skips="12"/>
|
||||
<OverallResultsCases successes="317" failures="95" expectedFailures="18" skips="6"/>
|
||||
</Catch2TestRun>
|
||||
|
||||
@@ -360,3 +360,12 @@ TEST_CASE( "Scoped message applies to all assertions in scope",
|
||||
CHECK( false );
|
||||
CHECK( false );
|
||||
}
|
||||
|
||||
TEST_CASE(
|
||||
"Delayed unscoped message clearing does not catch newly inserted messages",
|
||||
"[messages][unscoped][!shouldfail]" ) {
|
||||
UNSCOPED_INFO( "a" );
|
||||
REQUIRE( true );
|
||||
UNSCOPED_INFO( "b" );
|
||||
REQUIRE( false );
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user