Skip to content

Commit

Permalink
Better catch-utils
Browse files Browse the repository at this point in the history
  • Loading branch information
mathbunnyru committed Nov 21, 2024
1 parent f75b6e4 commit c37538f
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 3 deletions.
5 changes: 4 additions & 1 deletion libmamba/tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,11 @@ set(
LIBMAMBA_TEST_SRCS
include/mambatests.hpp
src/test_main.cpp
# Catch utils
src/catch-utils/conda_url.hpp
src/catch-utils/msvc_catch_byte.cpp
src/catch-utils/msvc_catch_string_view.cpp
# Utility library
src/util/msvc_catch_byte.cpp
src/util/test_cast.cpp
src/util/test_compare.cpp
src/util/test_cryptography.cpp
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
// Distributed under the terms of the BSD 3-Clause License.
//
// The full license is in the file LICENSE, distributed with this software.
#pragma once

#include <string>

Expand Down
File renamed without changes.
22 changes: 22 additions & 0 deletions libmamba/tests/src/catch-utils/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
2 changes: 1 addition & 1 deletion libmamba/tests/src/core/test_channel_context.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#include "mamba/util/flat_set.hpp"
#include "mamba/util/url_manip.hpp"

#include "catch-printer/conda_url.hpp"
#include "catch-utils/conda_url.hpp"

#include "mambatests.hpp"

Expand Down
2 changes: 1 addition & 1 deletion libmamba/tests/src/specs/test_channel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#include "mamba/util/path_manip.hpp"
#include "mamba/util/string.hpp"

#include "catch-printer/conda_url.hpp"
#include "catch-utils/conda_url.hpp"

namespace
{
Expand Down

0 comments on commit c37538f

Please sign in to comment.