Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update catch2 to v3 #82

Merged
merged 2 commits into from
Oct 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ endif()
include(EnableCcache)
include(ClangTidy)
include(PedanticCompiler)
include(ThirdParties)

set(CMAKE_EXPORT_COMPILE_COMMANDS ${MASTER_PROJECT})
option(LIBUNICODE_COVERAGE "libunicode: Builds with codecov [default: OFF]" OFF)
Expand All @@ -45,6 +44,8 @@ option(LIBUNICODE_TESTING "libunicode: Enables building of unittests for libunic
option(LIBUNICODE_TOOLS "libunicode: Builds CLI tools [default: ${MASTER_PROJECT}]" ${MASTER_PROJECT})
option(LIBUNICODE_BUILD_STATIC "libunicode: provide static library instead of dynamic [default: ${LIBUNICODE_BUILD_STATIC_DEFAULT}]" ${LIBUNICODE_BUILD_STATIC_DEFAULT})

include(ThirdParties)

if(LIBUNICODE_TESTING)
enable_testing()
endif()
Expand Down Expand Up @@ -100,3 +101,5 @@ message(STATUS "Using ccache: ${USING_CCACHE_STRING}")
message(STATUS "Using UCD directory: ${LIBUNICODE_UCD_DIR}")
message(STATUS "Enable clang-tidy: ${ENABLE_TIDY} (${CMAKE_CXX_CLANG_TIDY})")
message(STATUS "------------------------------------------------------------------------------")

ThirdPartiesSummary2()
2 changes: 1 addition & 1 deletion cmake/ThirdParties.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ endmacro()
# via find_package, usually system installed packages.

if(LIBUNICODE_TESTING)
if (TARGET Catch2::Catch2)
if(TARGET Catch2::Catch2WithMain)
christianparpart marked this conversation as resolved.
Show resolved Hide resolved
set(THIRDPARTY_BUILTIN_Catch2 "embedded")
else()
find_package(Catch2 REQUIRED)
Expand Down
6 changes: 3 additions & 3 deletions scripts/install-deps.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ class ThirdParty
$ThirdParties =
@(
[ThirdParty]@{
Folder="Catch2-2.13.7";
Archive="Catch2-2.13.7.zip";
URI="https://github.com/catchorg/Catch2/archive/refs/tags/v2.13.7.zip"
Folder="Catch2-3.4.0";
Archive="Catch2-3.4.0.zip";
URI="https://github.com/catchorg/Catch2/archive/refs/tags/v3.4.0.zip"
};
)

Expand Down
6 changes: 3 additions & 3 deletions scripts/install-deps.sh
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,9 @@ fetch_and_unpack()
fetch_and_unpack_Catch2()
{
fetch_and_unpack \
Catch2-2.13.7 \
Catch2-2.13.7.tar.gz \
https://github.com/catchorg/Catch2/archive/refs/tags/v2.13.7.tar.gz
Catch2-3.4.0 \
Catch2-3.4.0.tar.gz \
https://github.com/catchorg/Catch2/archive/refs/tags/v3.4.0.tar.gz
}

fetch_and_unpack_fmtlib()
Expand Down
11 changes: 10 additions & 1 deletion src/libunicode/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,16 @@ if(LIBUNICODE_TESTING)
width_test.cpp
word_segmenter_test.cpp
)
target_link_libraries(unicode_test unicode Catch2::Catch2 fmt::fmt-header-only)

# supress conversion warnings for Catch2
# https://github.com/catchorg/Catch2/issues/2583
# https://github.com/SFML/SFML/blob/e45628e2ebc5843baa3739781276fa85a54d4653/test/CMakeLists.txt#L18-L22
set_target_properties(Catch2 PROPERTIES COMPILE_OPTIONS "" EXPORT_COMPILE_COMMANDS OFF)
set_target_properties(Catch2WithMain PROPERTIES EXPORT_COMPILE_COMMANDS OFF)
get_target_property(CATCH2_INCLUDE_DIRS Catch2 INTERFACE_INCLUDE_DIRECTORIES)
target_include_directories(Catch2 SYSTEM INTERFACE ${CATCH2_INCLUDE_DIRS})

target_link_libraries(unicode_test unicode Catch2::Catch2WithMain fmt::fmt-header-only)
add_test(unicode_test unicode_test)
endif()
# }}}
2 changes: 1 addition & 1 deletion src/libunicode/capi_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

#include <fmt/format.h>

#include <catch2/catch.hpp>
#include <catch2/catch_test_macros.hpp>

#include <array>
#include <utility>
Expand Down
2 changes: 1 addition & 1 deletion src/libunicode/convert_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

#include <fmt/format.h>

#include <catch2/catch.hpp>
#include <catch2/catch_test_macros.hpp>

#include <iterator>

Expand Down
2 changes: 1 addition & 1 deletion src/libunicode/emoji_segmenter_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

#include <fmt/format.h>

#include <catch2/catch.hpp>
#include <catch2/catch_test_macros.hpp>

using namespace unicode;
using namespace std::string_literals;
Expand Down
2 changes: 1 addition & 1 deletion src/libunicode/grapheme_segmenter_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
#include <libunicode/convert.h>
#include <libunicode/grapheme_segmenter.h>

#include <catch2/catch.hpp>
#include <catch2/catch_test_macros.hpp>

using namespace unicode;
using namespace std::string_literals;
Expand Down
2 changes: 1 addition & 1 deletion src/libunicode/run_segmenter_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
#include <fmt/format.h>
#include <fmt/ostream.h>

#include <catch2/catch.hpp>
#include <catch2/catch_test_macros.hpp>

#include <array>
#include <sstream>
Expand Down
2 changes: 1 addition & 1 deletion src/libunicode/scan_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

#include <fmt/format.h>

#include <catch2/catch.hpp>
#include <catch2/catch_test_macros.hpp>

#include <string_view>

Expand Down
2 changes: 1 addition & 1 deletion src/libunicode/script_segmenter_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
*/
#include <libunicode/script_segmenter.h>

#include <catch2/catch.hpp>
#include <catch2/catch_test_macros.hpp>

#include <string>
#include <string_view>
Expand Down
2 changes: 1 addition & 1 deletion src/libunicode/test_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
* limitations under the License.
*/
#define CATCH_CONFIG_RUNNER
#include <catch2/catch.hpp>
#include <catch2/catch_session.hpp>

int main(int argc, char const* argv[])
{
Expand Down
2 changes: 1 addition & 1 deletion src/libunicode/utf8_grapheme_segmenter_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

#include <fmt/format.h>

#include <catch2/catch.hpp>
#include <catch2/catch_test_macros.hpp>

#include <string_view>

Expand Down
2 changes: 1 addition & 1 deletion src/libunicode/utf8_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

#include <fmt/format.h>

#include <catch2/catch.hpp>
#include <catch2/catch_test_macros.hpp>

#include <array>
#include <cassert>
Expand Down
2 changes: 1 addition & 1 deletion src/libunicode/width_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
*/
#include <libunicode/width.h>

#include <catch2/catch.hpp>
#include <catch2/catch_test_macros.hpp>

TEST_CASE("random test", "[width]")
{
Expand Down
2 changes: 1 addition & 1 deletion src/libunicode/word_segmenter_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
*/
#include <libunicode/word_segmenter.h>

#include <catch2/catch.hpp>
#include <catch2/catch_test_macros.hpp>

using namespace unicode;
using namespace std::string_literals;
Expand Down