Skip to content

Commit c53b5d8

Browse files
committed
test: update Catch2 to use version 2.11.0
1 parent 7af16d3 commit c53b5d8

File tree

3 files changed

+13
-10
lines changed

3 files changed

+13
-10
lines changed

tests/CMakeLists.txt

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ if(BUILD_TESTING)
33

44
FetchContent_Declare(
55
libcatch2
6-
URL https://github.com/catchorg/Catch2/archive/v2.13.6.tar.gz
7-
# GIT_REPOSITORY https://github.com/catchorg/Catch2.git
8-
# GIT_TAG 15cf3ca
6+
URL https://github.com/catchorg/Catch2/archive/v3.11.0.tar.gz
7+
URL_HASH SHA1=5f5a932acf6990764c33ed80ee04f1c696f4d5bc
8+
DOWNLOAD_EXTRACT_TIMESTAMP true
99
)
1010

1111
FetchContent_MakeAvailable(libcatch2)
@@ -22,7 +22,7 @@ if(BUILD_TESTING)
2222
URL ${PROJECT_BINARY_DIR}/metadata_test_images.tar.gz
2323
)
2424
FetchContent_MakeAvailable(test_images)
25-
add_executable(tester test-main.cpp test-basic.cpp test_exceptions.cpp)
25+
add_executable(tester test-basic.cpp test_exceptions.cpp)
2626
target_include_directories(tester PRIVATE ${PROJECT_SOURCE_DIR}/uiucprescon/imagevalidate)
2727

2828
target_compile_definitions(tester PRIVATE TEST_IMAGE_PATH="${test_images_SOURCE_DIR}")
@@ -36,14 +36,14 @@ if(BUILD_TESTING)
3636
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
3737
)
3838

39-
target_link_libraries(tester PRIVATE Catch2 imagevalidate::glue)
39+
target_link_libraries(tester PRIVATE Catch2::Catch2WithMain imagevalidate::glue)
4040
catch_discover_tests(tester
4141
TEST_PREFIX imagevalidate.
4242
)
4343

4444
#############
4545

46-
add_executable(tester-internal test-main.cpp tester-internal.cpp)
46+
add_executable(tester-internal tester-internal.cpp)
4747
if(CMAKE_CXX_CPPCHECK)
4848
set_property(TARGET tester-internal PROPERTY
4949
CXX_CPPCHECK ${CMAKE_CXX_CPPCHECK};--suppress=*:${libcatch2_SOURCE_DIR}/single_include/catch2/catch.hpp

tests/test-basic.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#include "glue.h"
22
#include "exceptions.h"
3-
#include <catch2/catch.hpp>
3+
#include <catch2/catch_test_macros.hpp>
44

55

66
TEST_CASE("utils"){

tests/test_exceptions.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,15 @@
22
// Created by Borchers, Henry Samuel on 5/25/21.
33
//
44

5-
#include "catch2/catch.hpp"
65
#include "exceptions.h"
76

7+
#include <catch2/catch_test_macros.hpp>
8+
#include <catch2/matchers/catch_matchers_string.hpp>
9+
#include <catch2/matchers/catch_matchers_exception.hpp>
10+
811
TEST_CASE("InvalidFileException filename only"){
9-
REQUIRE_THROWS_WITH(throw InvalidFileException("myfile.txt"), Catch::Equals( "myfile.txt" ));
12+
REQUIRE_THROWS_WITH(throw InvalidFileException("myfile.txt"), Catch::Matchers::Equals( "myfile.txt" ));
1013
}
1114
TEST_CASE("InvalidFileException filename with message"){
12-
REQUIRE_THROWS_WITH(throw InvalidFileException("myfile.txt", "did something stupid"), Catch::Equals( "myfile.txt: did something stupid" ));
15+
REQUIRE_THROWS_WITH(throw InvalidFileException("myfile.txt", "did something stupid"), Catch::Matchers::Equals( "myfile.txt: did something stupid" ));
1316
}

0 commit comments

Comments
 (0)