Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ expand_template(
"#cmakedefine CATCH_CONFIG_USE_ASYNC": "",
"#cmakedefine CATCH_CONFIG_WCHAR": "",
"#cmakedefine CATCH_CONFIG_WINDOWS_CRTDBG": "",
"#cmakedefine CATCH_CONFIG_RUN_ORDER_DECLARED": "",
"#cmakedefine CATCH_CONFIG_WINDOWS_SEH": "",
"#cmakedefine CATCH_CONFIG_USE_BUILTIN_CONSTANT_P": "",
"#cmakedefine CATCH_CONFIG_NO_USE_BUILTIN_CONSTANT_P": "",
Expand Down
4 changes: 4 additions & 0 deletions docs/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ by using `_NO_` in the macro, e.g. `CATCH_CONFIG_NO_CPP17_UNCAUGHT_EXCEPTIONS`.
CATCH_CONFIG_FAST_COMPILE // Sacrifices some (rather minor) features for compilation speed
CATCH_CONFIG_POSIX_SIGNALS // Enable handling POSIX signals
CATCH_CONFIG_WINDOWS_CRTDBG // Enable leak checking using Windows's CRT Debug Heap
CATCH_CONFIG_RUN_ORDER_DECLARED // Changes the default tests run behavior to declaration ordered
CATCH_CONFIG_DISABLE_STRINGIFICATION // Disable stringifying the original expression
CATCH_CONFIG_DISABLE // Disables assertions and test case registration
CATCH_CONFIG_WCHAR // Enables use of wchart_t
Expand Down Expand Up @@ -181,6 +182,9 @@ CRT is used to check for memory leaks, and displays them after the tests
finish running. This option only works when linking against the default
main, and must be defined for the whole library build.

`CATCH_CONFIG_RUN_ORDER_DECLARED` is off by default. If enabled, it restores
the tests run ordering as it was before Catch2 3.9.0.

`CATCH_CONFIG_WCHAR` is on by default, but can be disabled. Currently
it is only used in support for DJGPP cross-compiler.

Expand Down
6 changes: 6 additions & 0 deletions src/catch2/catch_config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,12 @@ namespace Catch {
return lhs.type == rhs.type && lhs.filter == rhs.filter;
}

ConfigData::ConfigData() {
#if defined( CATCH_CONFIG_RUN_ORDER_DECLARED )
runOrder = TestRunOrder::Declared;
#endif
}

Comment on lines +99 to +104

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wondered if I should add the compile time check to the header directly instead of creating a constructor, but I see that the catch_user_config.hpp is not included there and this is why I leaned towards creating a constructor. However if including the user config directly in catch_config.hpp is considered ok, I can move it there.

Config::Config( ConfigData const& data ):
m_data( data ) {
// We need to trim filter specs to avoid trouble with superfluous
Expand Down
2 changes: 2 additions & 0 deletions src/catch2/catch_config.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ namespace Catch {

struct ConfigData {

ConfigData();

bool listTests = false;
bool listTags = false;
bool listReporters = false;
Expand Down
1 change: 1 addition & 0 deletions src/catch2/catch_user_config.hpp.in
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,7 @@
#cmakedefine CATCH_CONFIG_PREFIX_ALL
#cmakedefine CATCH_CONFIG_PREFIX_MESSAGES
#cmakedefine CATCH_CONFIG_WINDOWS_CRTDBG
#cmakedefine CATCH_CONFIG_RUN_ORDER_DECLARED

#cmakedefine CATCH_CONFIG_SHARED_LIBRARY

Expand Down