Skip to content

Commit 013f485

Browse files
committed
Add CMake stuff for new tests after rebase.
1 parent e63eb30 commit 013f485

File tree

8 files changed

+44
-5
lines changed

8 files changed

+44
-5
lines changed

test/CMakeLists.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ foreach(directory ${directories})
5858
add_subdirectory(${directory})
5959

6060
get_filename_component(dirname ${directory} NAME)
61-
if(dirname STREQUAL "test_utils")
61+
if((dirname STREQUAL "test_utils") OR (dirname STREQUAL "gtest_utils"))
6262
continue()
6363
endif()
6464

test/gtest_utils/CMakeLists.txt

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
cmake_minimum_required(VERSION 3.16)
2+
3+
find_package(GTest CONFIG REQUIRED)
4+
5+
add_library(gtest_utils STATIC
6+
gtest_utils.cpp
7+
gtest_utils.h
8+
)
9+
set_target_properties(gtest_utils PROPERTIES FOLDER tests)
10+
target_link_libraries(gtest_utils PUBLIC GTest::gtest)
11+
target_include_directories(gtest_utils PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})

test/usvfs_global_test_runner/gtest_utils.cpp renamed to test/gtest_utils/gtest_utils.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ ::testing::AssertionResult AssertContentEquals(std::string_view expected,
105105
const std::filesystem::path& path,
106106
bool trim)
107107
{
108-
const auto content = read_content(path);
108+
const auto content = read_content(path, trim);
109109

110110
if (!content) {
111111
return ::testing::AssertionFailure()

test/test_utils/CMakeLists.txt

+4-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,10 @@ cmake_minimum_required(VERSION 3.16)
22

33
find_package(GTest CONFIG REQUIRED)
44

5-
add_library(test_utils STATIC test_helpers.cpp test_helpers.h)
5+
add_library(test_utils STATIC
6+
test_helpers.cpp
7+
test_helpers.h
8+
)
69
set_target_properties(test_utils PROPERTIES FOLDER tests)
710
target_link_libraries(test_utils PUBLIC shared)
811
target_include_directories(test_utils PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
cmake_minimum_required(VERSION 3.16)
2+
3+
find_package(GTest CONFIG REQUIRED)
4+
5+
# other executables
6+
add_executable(usvfs_global_test
7+
usvfs_global_test/usvfs_global_test.cpp
8+
)
9+
usvfs_set_test_properties(usvfs_global_test FOLDER usvfs_global_test)
10+
target_link_libraries(usvfs_global_test PRIVATE gtest_utils GTest::gtest_main)
11+
12+
# actual test executable
13+
add_executable(usvfs_global_test_runer
14+
usvfs_global_test_fixture.cpp
15+
usvfs_global_test_fixture.h
16+
usvfs_global_test_runner.cpp
17+
)
18+
usvfs_set_test_properties(usvfs_global_test_runer FOLDER usvfs_global_test)
19+
usvfs_target_link_usvfs(usvfs_global_test_runer)
20+
target_link_libraries(usvfs_global_test_runer
21+
PRIVATE test_utils gtest_utils GTest::gtest_main)
22+
add_dependencies(usvfs_global_test_runer usvfs_global_test)

test/usvfs_global_test/usvfs_global_test.cpp renamed to test/usvfs_global_test_runner/usvfs_global_test/usvfs_global_test.cpp

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
#include <gtest/gtest.h>
22

3+
#define WIN32_LEAN_AND_MEAN
4+
#include <Windows.h>
5+
36
#include <filesystem>
47
#include <fstream>
58

6-
#include "../usvfs_global_test_runner/gtest_utils.h"
9+
#include <gtest_utils.h>
710

811
// anonymous class that allow tests to access parameters (currently only where the
912
// virtualized data folder is)

test/usvfs_global_test_runner/usvfs_global_test_runner.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
#include <test_helpers.h>
44
#include <usvfs.h>
5+
#include <gtest_utils.h>
56

6-
#include "gtest_utils.h"
77
#include "usvfs_global_test_fixture.h"
88

99
TEST_F(UsvfsGlobalTest, BasicTest)

0 commit comments

Comments
 (0)