add support for testing with catch 3
Some checks reported errors
continuous-integration/drone/push Build was killed
Some checks reported errors
continuous-integration/drone/push Build was killed
This commit is contained in:
parent
c0a2f7e779
commit
bbc412db45
@ -5,11 +5,16 @@ file(COPY "test.epub3" DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
|
||||
|
||||
find_package(Catch2 CONFIG)
|
||||
|
||||
if(Catch2_FOUND) # Catch 2.x
|
||||
if(Catch2_FOUND) # Catch 2.x / 3.x
|
||||
include(Catch)
|
||||
add_executable(all_tests main.cpp ${sources_tests})
|
||||
target_link_libraries(all_tests
|
||||
PRIVATE Catch2::Catch2 ${PROJECT_NAME}_lib)
|
||||
if(TARGET Catch2::Catch2WithMain) # Catch 3.x
|
||||
target_link_libraries(all_tests
|
||||
PRIVATE Catch2::Catch2WithMain ${PROJECT_NAME})
|
||||
else() # Catch 2.x
|
||||
target_link_libraries(all_tests
|
||||
PRIVATE Catch2::Catch2 ${PROJECT_NAME})
|
||||
endif()
|
||||
target_include_directories(all_tests PRIVATE "/usr/include/catch2")
|
||||
catch_discover_tests(all_tests EXTRA_ARGS "${EXTRA_TEST_ARGS}")
|
||||
else() # Catch 1.x
|
||||
|
@ -1,3 +1,8 @@
|
||||
#define CATCH_CONFIG_MAIN
|
||||
|
||||
#include <catch.hpp>
|
||||
// catch 3 does not have catch.hpp anymore
|
||||
#if __has_include(<catch.hpp>)
|
||||
# include <catch.hpp>
|
||||
#else
|
||||
# include <catch_all.hpp>
|
||||
#endif
|
||||
|
@ -1,7 +1,12 @@
|
||||
#include "fs-compat.hpp"
|
||||
#include "helpers.hpp"
|
||||
|
||||
#include <catch.hpp>
|
||||
// catch 3 does not have catch.hpp anymore
|
||||
#if __has_include(<catch.hpp>)
|
||||
# include <catch.hpp>
|
||||
#else
|
||||
# include <catch_all.hpp>
|
||||
#endif
|
||||
|
||||
#include <array>
|
||||
#include <exception>
|
||||
|
@ -2,7 +2,12 @@
|
||||
#include "options.hpp"
|
||||
#include "search.hpp"
|
||||
|
||||
#include <catch.hpp>
|
||||
// catch 3 does not have catch.hpp anymore
|
||||
#if __has_include(<catch.hpp>)
|
||||
# include <catch.hpp>
|
||||
#else
|
||||
# include <catch_all.hpp>
|
||||
#endif
|
||||
|
||||
#include <clocale>
|
||||
#include <exception>
|
||||
|
@ -2,7 +2,12 @@
|
||||
#include "fs-compat.hpp"
|
||||
#include "search.hpp"
|
||||
|
||||
#include <catch.hpp>
|
||||
// catch 3 does not have catch.hpp anymore
|
||||
#if __has_include(<catch.hpp>)
|
||||
# include <catch.hpp>
|
||||
#else
|
||||
# include <catch_all.hpp>
|
||||
#endif
|
||||
|
||||
#include <clocale>
|
||||
#include <exception>
|
||||
|
@ -2,7 +2,12 @@
|
||||
#include "options.hpp"
|
||||
#include "search.hpp"
|
||||
|
||||
#include <catch.hpp>
|
||||
// catch 3 does not have catch.hpp anymore
|
||||
#if __has_include(<catch.hpp>)
|
||||
# include <catch.hpp>
|
||||
#else
|
||||
# include <catch_all.hpp>
|
||||
#endif
|
||||
|
||||
#include <clocale>
|
||||
#include <exception>
|
||||
|
@ -1,7 +1,12 @@
|
||||
#include "fs-compat.hpp"
|
||||
#include "zip.hpp"
|
||||
|
||||
#include <catch.hpp>
|
||||
// catch 3 does not have catch.hpp anymore
|
||||
#if __has_include(<catch.hpp>)
|
||||
# include <catch.hpp>
|
||||
#else
|
||||
# include <catch_all.hpp>
|
||||
#endif
|
||||
|
||||
#include <clocale>
|
||||
#include <exception>
|
||||
|
Loading…
x
Reference in New Issue
Block a user