Skip to content

Commit

Permalink
maint: Use Catch2 instead of doctest (#3618)
Browse files Browse the repository at this point in the history
  • Loading branch information
mathbunnyru authored Dec 6, 2024
1 parent 633d8d0 commit c3a2c1c
Show file tree
Hide file tree
Showing 90 changed files with 6,330 additions and 6,284 deletions.
2 changes: 1 addition & 1 deletion dev/environment-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ dependencies:
- yaml-cpp >=0.8.0
- sel(win): winreg
# libmamba test dependencies
- doctest
- catch2
# micromamba dependencies
- cli11 >=2.2
# micromamba test dependencies
Expand Down
2 changes: 1 addition & 1 deletion dev/environment-micromamba-static.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,6 @@ dependencies:
- libnghttp2-static
- lz4-c-static
# libmamba test dependencies
- doctest
- catch2
# micromamba dependencies
- cli11 >=2.2,<3
10 changes: 6 additions & 4 deletions libmamba/ext/solv-cpp/tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ cmake_minimum_required(VERSION 3.16)
add_executable(
test_solv_cpp
src/main.cpp
src/msvc_catch_string_view.cpp
src/pool_data.cpp
src/test_pool.cpp
src/test_queue.cpp
Expand All @@ -19,7 +20,8 @@ add_executable(
src/test_transaction.cpp
)
target_include_directories(test_solv_cpp PRIVATE src/)
target_compile_definitions(test_solv_cpp PRIVATE DOCTEST_CONFIG_USE_STD_HEADERS)

find_package(doctest REQUIRED)
target_link_libraries(test_solv_cpp PRIVATE doctest::doctest solv::cpp)
find_package(Catch2 REQUIRED)
target_link_libraries(test_solv_cpp PRIVATE Catch2::Catch2WithMain solv::cpp)
set_target_properties(
test_solv_cpp PROPERTIES COMPILE_DEFINITIONS CATCH_CONFIG_ENABLE_ALL_STRINGMAKERS
)
4 changes: 2 additions & 2 deletions libmamba/ext/solv-cpp/tests/src/main.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#define DOCTEST_CONFIG_IMPLEMENT_WITH_MAIN
#define CATCH_CONFIG_MAIN

#include <doctest/doctest.h>
#include <catch2/catch_all.hpp>
22 changes: 22 additions & 0 deletions libmamba/ext/solv-cpp/tests/src/msvc_catch_string_view.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#ifdef _WIN32

// Catch compiled on `conda-forge` for MSVC doesn't support outputting `string_view`.
// So we have to define StringMaker for it ourselves.
// The declaration is present though, so this only causes link errors.

#include <string>
#include <string_view>

#include <catch2/catch_tostring.hpp>

namespace Catch
{

std::string StringMaker<std::string_view>::convert(std::string_view str)
{
return std::string(str);
}

}

#endif
Loading

0 comments on commit c3a2c1c

Please sign in to comment.