Added Catch v3 support. (#2656)
This commit is contained in:
		
							
								
								
									
										2
									
								
								.github/workflows/ci.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								.github/workflows/ci.yml
									
									
									
									
										vendored
									
									
								
							@@ -27,7 +27,7 @@ jobs:
 | 
			
		||||
      - uses: actions/checkout@main
 | 
			
		||||
      - name: Setup
 | 
			
		||||
        run: |
 | 
			
		||||
          apt-get update && apt-get install -y curl
 | 
			
		||||
          apt-get update && apt-get install -y curl git
 | 
			
		||||
          CMAKE_VERSION="3.24.2"
 | 
			
		||||
          curl -sSL https://github.com/Kitware/CMake/releases/download/v${CMAKE_VERSION}/cmake-${CMAKE_VERSION}-linux-x86_64.sh -o install-cmake.sh
 | 
			
		||||
          chmod +x install-cmake.sh
 | 
			
		||||
 
 | 
			
		||||
@@ -13,6 +13,20 @@ if(PkgConfig_FOUND)
 | 
			
		||||
    pkg_check_modules(systemd libsystemd)
 | 
			
		||||
endif()
 | 
			
		||||
 | 
			
		||||
find_package(Catch2 3 QUIET)
 | 
			
		||||
if (Catch2_FOUND)
 | 
			
		||||
    message(STATUS "Packaged version of Catch will be used.")
 | 
			
		||||
else()
 | 
			
		||||
    message(STATUS "Bundled version of Catch will be downloaded and used.")
 | 
			
		||||
    include(FetchContent)
 | 
			
		||||
    FetchContent_Declare(
 | 
			
		||||
        Catch2
 | 
			
		||||
        GIT_REPOSITORY https://github.com/catchorg/Catch2.git
 | 
			
		||||
        GIT_TAG v3.3.2
 | 
			
		||||
    )
 | 
			
		||||
    FetchContent_MakeAvailable(Catch2)
 | 
			
		||||
endif()
 | 
			
		||||
 | 
			
		||||
set(SPDLOG_UTESTS_SOURCES
 | 
			
		||||
    test_file_helper.cpp
 | 
			
		||||
    test_file_logging.cpp
 | 
			
		||||
@@ -53,6 +67,7 @@ function(spdlog_prepare_test test_target spdlog_lib)
 | 
			
		||||
    if(systemd_FOUND)
 | 
			
		||||
        target_link_libraries(${test_target} PRIVATE ${systemd_LIBRARIES})
 | 
			
		||||
    endif()
 | 
			
		||||
    target_link_libraries(${test_target} PRIVATE Catch2::Catch2WithMain)
 | 
			
		||||
    if(SPDLOG_SANITIZE_ADDRESS)
 | 
			
		||||
        spdlog_enable_sanitizer(${test_target})
 | 
			
		||||
    endif()
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										17959
									
								
								tests/catch.hpp
									
									
									
									
									
								
							
							
						
						
									
										17959
									
								
								tests/catch.hpp
									
									
									
									
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							@@ -1,23 +0,0 @@
 | 
			
		||||
Boost Software License - Version 1.0 - August 17th, 2003
 | 
			
		||||
 | 
			
		||||
Permission is hereby granted, free of charge, to any person or organization
 | 
			
		||||
obtaining a copy of the software and accompanying documentation covered by
 | 
			
		||||
this license (the "Software") to use, reproduce, display, distribute,
 | 
			
		||||
execute, and transmit the Software, and to prepare derivative works of the
 | 
			
		||||
Software, and to permit third-parties to whom the Software is furnished to
 | 
			
		||||
do so, all subject to the following:
 | 
			
		||||
 | 
			
		||||
The copyright notices in the Software and this entire statement, including
 | 
			
		||||
the above license grant, this restriction and the following disclaimer,
 | 
			
		||||
must be included in all copies of the Software, in whole or in part, and
 | 
			
		||||
all derivative works of the Software, unless such copies or derivative
 | 
			
		||||
works are solely in the form of machine-executable object code generated by
 | 
			
		||||
a source language processor.
 | 
			
		||||
 | 
			
		||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 | 
			
		||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 | 
			
		||||
FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
 | 
			
		||||
SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
 | 
			
		||||
FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
 | 
			
		||||
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
 | 
			
		||||
DEALINGS IN THE SOFTWARE.
 | 
			
		||||
@@ -4,7 +4,7 @@
 | 
			
		||||
#    pragma GCC diagnostic push
 | 
			
		||||
#    pragma GCC diagnostic ignored "-Wmaybe-uninitialized" // Workaround for GCC 12
 | 
			
		||||
#endif
 | 
			
		||||
#include "catch.hpp"
 | 
			
		||||
#include <catch2/catch_all.hpp>
 | 
			
		||||
#if defined(__GNUC__) && __GNUC__ == 12
 | 
			
		||||
#    pragma GCC diagnostic pop
 | 
			
		||||
#endif
 | 
			
		||||
 
 | 
			
		||||
@@ -3,8 +3,7 @@
 | 
			
		||||
#    pragma GCC diagnostic ignored "-Wmaybe-uninitialized" // Workaround for GCC 12
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#define CATCH_CONFIG_MAIN
 | 
			
		||||
#include "catch.hpp"
 | 
			
		||||
#include <catch2/catch_all.hpp>
 | 
			
		||||
 | 
			
		||||
#if defined(__GNUC__) && __GNUC__ == 12
 | 
			
		||||
#    pragma GCC diagnostic pop
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user