-
Notifications
You must be signed in to change notification settings - Fork 51
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #36 from approvals/existing_catch_main
Support Existing catch main
- Loading branch information
Showing
11 changed files
with
75 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
add_subdirectory(catch2_existing_main) | ||
add_subdirectory(googletest_existing_main) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
project(catch2_existing_main) | ||
set(CMAKE_CXX_STANDARD 11) | ||
add_executable(${PROJECT_NAME} | ||
main.cpp | ||
Catch2ApprovalsTests.cpp | ||
) | ||
target_link_libraries(${PROJECT_NAME} ApprovalTests catch2) | ||
target_include_directories(${PROJECT_NAME} | ||
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../../tests/Catch2_Tests) | ||
|
||
add_test(NAME ${PROJECT_NAME} COMMAND ${PROJECT_NAME}) |
1 change: 1 addition & 0 deletions
1
examples/catch2_existing_main/Catch2ApprovalsTests.TestStreamableObject.approved.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
42 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#include "Catch.hpp" | ||
#include "ApprovalTests/Approvals.h" | ||
|
||
using namespace ApprovalTests; | ||
|
||
TEST_CASE("TestStreamableObject") | ||
{ | ||
Approvals::verify(42); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
// begin-snippet: catch_existing_main | ||
// main.cpp: | ||
|
||
// Add these two lines to your main: | ||
#define APPROVALS_CATCH_EXISTING_MAIN | ||
#include "ApprovalTests.hpp" | ||
|
||
int main( int argc, char* argv[] ) | ||
{ | ||
// your existing setup... | ||
int result = Catch::Session().run( argc, argv ); | ||
// your existing clean-up... | ||
return result; | ||
} | ||
// end-snippet |