void-packages/srcpkgs/j4-dmenu-desktop/patches/new-catch2.patch

111 lines
2.7 KiB
Diff
Raw Normal View History

2023-10-01 17:25:18 +02:00
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -5,18 +5,14 @@ project(j4-dmenu)
option(WITH_TESTS "Build and run tests" ON)
option(WITH_GIT_CATCH "Use a Git checkout of Catch to build the tests" ON)
-if(CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS "4.7")
- set(CXX_OPT "-std=c++0x")
-else()
- set(CXX_OPT "-std=c++11")
-endif()
-
+set(CMAKE_CXX_STANDARD 11)
# _WITH_GETLINE for FreeBSD
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CXX_OPT} -Wall -Wextra -pedantic -O2 -D_WITH_GETLINE")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DDEBUG")
if(WITH_TESTS)
enable_testing(true)
+ find_package(Catch2)
add_test(
NAME j4-dmenu-tests
COMMAND j4-dmenu-tests
@@ -25,6 +21,8 @@ if(WITH_TESTS)
j4-dmenu-tests
src/Test.cc
)
+ set_property(TARGET j4-dmenu-tests PROPERTY CXX_STANDARD 17)
+ target_link_libraries(j4-dmenu-tests Catch2::Catch2WithMain)
add_definitions(-DTEST_FILES="${CMAKE_CURRENT_SOURCE_DIR}/test_files/")
if(WITH_GIT_CATCH)
--- a/src/Test.cc
+++ b/src/Test.cc
@@ -1,8 +1,7 @@
//#include "Application.hh"
-#define CATCH_CONFIG_MAIN
-#include "catch.hpp"
+#include "catch2/catch_all.hpp"
static const std::string test_files = TEST_FILES;
--- a/src/TestApplication.cc
+++ b/src/TestApplication.cc
@@ -5,7 +5,7 @@
#include "Application.hh"
#include "LocaleSuffixes.hh"
-#include "catch.hpp"
+#include "catch2/catch_all.hpp"
TEST_CASE("Application/invalid_file", "")
{
--- a/src/TestApplicationRunner.cc
+++ b/src/TestApplicationRunner.cc
@@ -3,7 +3,7 @@
#include "Application.hh"
#include "ApplicationRunner.hh"
#include "LocaleSuffixes.hh"
-#include "catch.hpp"
+#include "catch2/catch_all.hpp"
TEST_CASE("ApplicationRunner/escape", "Regression test for issue #18, %c was not escaped")
{
--- a/src/TestFileFinder.cc
+++ b/src/TestFileFinder.cc
@@ -3,7 +3,7 @@
#include <vector>
#include "FileFinder.hh"
-#include "catch.hpp"
+#include "catch2/catch_all.hpp"
std::vector<std::string> ff2l(FileFinder &ff)
{
--- a/src/TestFormatters.cc
+++ b/src/TestFormatters.cc
@@ -3,7 +3,7 @@
#include <stdlib.h>
#include <string>
-#include "catch.hpp"
+#include "catch2/catch_all.hpp"
#include "Application.hh"
#include "LocaleSuffixes.hh"
--- a/src/TestLocaleSuffixes.cc
+++ b/src/TestLocaleSuffixes.cc
@@ -1,7 +1,7 @@
#include <string.h>
#include "LocaleSuffixes.hh"
-#include "catch.hpp"
+#include "catch2/catch_all.hpp"
TEST_CASE("LocaleSuffixes/with_encoding", "")
{
--- a/src/TestSearchPath.cc
+++ b/src/TestSearchPath.cc
@@ -5,7 +5,7 @@
#include <vector>
#include "SearchPath.hh"
-#include "catch.hpp"
+#include "catch2/catch_all.hpp"
TEST_CASE("SearchPath/XDG_DATA_HOME", "Check SearchPath honors XDG_DATA_HOME")
{