Skip to content

Commit c50e227

Browse files
committed
Add tests for test wrappers
1 parent 8f17a11 commit c50e227

File tree

5 files changed

+35
-2
lines changed

5 files changed

+35
-2
lines changed

tests/install/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,4 +48,4 @@ target_link_libraries(another_main PRIVATE myproj::lib myproj::lib2)
4848

4949
# tests
5050
enable_testing()
51-
add_test(NAME another_main COMMAND another_main)
51+
add_executable_test(another_main no_arg)

tests/myproj/CMakeLists.txt

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ add_subdirectory(libs)
9797

9898
## tests
9999
enable_testing()
100-
add_test(NAME main COMMAND main)
100+
add_executable_test(main no_arg)
101101

102102
# Header-only library
103103
add_library(lib INTERFACE)
@@ -120,6 +120,17 @@ target_link_libraries(lib2 PRIVATE myproj_project_options myproj_project_warning
120120
target_link_system_libraries(lib2 PRIVATE fmt::fmt Eigen3::Eigen)
121121
target_link_system_libraries(lib2 PRIVATE mythirdpartylib)
122122

123+
add_test_config(common
124+
DEPENDENCIES_CONFIG
125+
ut
126+
127+
SYSTEM_LIBRARIES
128+
Boost::ut
129+
)
130+
131+
add_library_test(lib lib CONFIGS common SOURCES tests/mylib/lib.cpp)
132+
add_library_test(lib2 lib CONFIGS common SOURCES tests/mylib2/lib.cpp)
133+
123134
# package everything automatically
124135
package_project(
125136
# NAME

tests/myproj/tests/mylib/lib.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#include "mylib/lib.hpp"
2+
3+
#include <boost/ut.hpp>
4+
5+
int main() { // NOLINT(bugprone-exception-escape)
6+
using namespace boost::ut; // NOLINT(*using-namespace*)
7+
8+
"lib"_test = []() { expect(some_fun() == 0); };
9+
}

tests/myproj/tests/mylib2/lib.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#include "mylib2/lib.hpp"
2+
3+
#include <boost/ut.hpp>
4+
5+
int main() { // NOLINT(bugprone-exception-escape)
6+
using namespace boost::ut; // NOLINT(*using-namespace*)
7+
8+
"lib"_test = []() { expect(some_fun2() == 0); };
9+
}

tests/myproj/vcpkg.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@
1111
{
1212
"name": "fmt",
1313
"version>=": "8.1.1"
14+
},
15+
{
16+
"name": "bext-ut",
17+
"version>=": "1.1.9"
1418
}
1519
]
1620
}

0 commit comments

Comments
 (0)