mirror of
https://github.com/catchorg/Catch2.git
synced 2024-11-25 23:06:10 +01:00
Outline throwing of TestSkipException
This commit is contained in:
parent
ba94278bdd
commit
1dfaa8abe7
@ -51,11 +51,7 @@ namespace Catch {
|
|||||||
throw_test_failure_exception();
|
throw_test_failure_exception();
|
||||||
}
|
}
|
||||||
if ( m_reaction.shouldSkip ) {
|
if ( m_reaction.shouldSkip ) {
|
||||||
#if !defined( CATCH_CONFIG_DISABLE_EXCEPTIONS )
|
throw_test_skip_exception();
|
||||||
throw Catch::TestSkipException();
|
|
||||||
#else
|
|
||||||
CATCH_ERROR( "Explicitly skipping tests during runtime requires exceptions" );
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -20,4 +20,12 @@ namespace Catch {
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void throw_test_skip_exception() {
|
||||||
|
#if !defined( CATCH_CONFIG_DISABLE_EXCEPTIONS )
|
||||||
|
throw Catch::TestSkipException();
|
||||||
|
#else
|
||||||
|
CATCH_ERROR( "Explicitly skipping tests during runtime requires exceptions" );
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace Catch
|
} // namespace Catch
|
||||||
|
@ -12,6 +12,8 @@ namespace Catch {
|
|||||||
|
|
||||||
//! Used to signal that an assertion macro failed
|
//! Used to signal that an assertion macro failed
|
||||||
struct TestFailureException{};
|
struct TestFailureException{};
|
||||||
|
//! Used to signal that the remainder of a test should be skipped
|
||||||
|
struct TestSkipException {};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Outlines throwing of `TestFailureException` into a single TU
|
* Outlines throwing of `TestFailureException` into a single TU
|
||||||
@ -20,8 +22,12 @@ namespace Catch {
|
|||||||
*/
|
*/
|
||||||
[[noreturn]] void throw_test_failure_exception();
|
[[noreturn]] void throw_test_failure_exception();
|
||||||
|
|
||||||
//! Used to signal that the remainder of a test should be skipped
|
/**
|
||||||
struct TestSkipException{};
|
* Outlines throwing of `TestSkipException` into a single TU
|
||||||
|
*
|
||||||
|
* Also handles `CATCH_CONFIG_DISABLE_EXCEPTIONS` for callers.
|
||||||
|
*/
|
||||||
|
[[noreturn]] void throw_test_skip_exception();
|
||||||
|
|
||||||
} // namespace Catch
|
} // namespace Catch
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user