add support for testing with catch 3
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
7de644d841
commit
7255df01e0
@ -3,11 +3,16 @@ include(CTest)
|
||||
file(GLOB sources_tests test_*.cpp)
|
||||
|
||||
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})
|
||||
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,5 +1,5 @@
|
||||
/* This file is part of mastodonpp.
|
||||
* Copyright © 2020 tastytea <tastytea@tastytea.de>
|
||||
* Copyright © 2020, 2022 tastytea <tastytea@tastytea.de>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
@ -16,4 +16,9 @@
|
||||
|
||||
#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,5 +1,5 @@
|
||||
/* This file is part of mastodonpp.
|
||||
* Copyright © 2020 tastytea <tastytea@tastytea.de>
|
||||
* Copyright © 2020, 2022 tastytea <tastytea@tastytea.de>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
@ -17,7 +17,12 @@
|
||||
#include "connection.hpp"
|
||||
#include "instance.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 <exception>
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* This file is part of mastodonpp.
|
||||
* Copyright © 2020 tastytea <tastytea@tastytea.de>
|
||||
* Copyright © 2020, 2022 tastytea <tastytea@tastytea.de>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
@ -16,7 +16,12 @@
|
||||
|
||||
#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 <exception>
|
||||
#include <string>
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* This file is part of mastodonpp.
|
||||
* Copyright © 2020 tastytea <tastytea@tastytea.de>
|
||||
* Copyright © 2020, 2022 tastytea <tastytea@tastytea.de>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
@ -16,7 +16,12 @@
|
||||
|
||||
#include "instance.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 <exception>
|
||||
#include <string>
|
||||
|
Loading…
x
Reference in New Issue
Block a user