Skip to content

Commit

Permalink
Add tests for test wrappers
Browse files Browse the repository at this point in the history
  • Loading branch information
FeignClaims committed Oct 17, 2023
1 parent 8f17a11 commit c50e227
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 2 deletions.
2 changes: 1 addition & 1 deletion tests/install/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,4 @@ target_link_libraries(another_main PRIVATE myproj::lib myproj::lib2)

# tests
enable_testing()
add_test(NAME another_main COMMAND another_main)
add_executable_test(another_main no_arg)
13 changes: 12 additions & 1 deletion tests/myproj/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ add_subdirectory(libs)

## tests
enable_testing()
add_test(NAME main COMMAND main)
add_executable_test(main no_arg)

# Header-only library
add_library(lib INTERFACE)
Expand All @@ -120,6 +120,17 @@ target_link_libraries(lib2 PRIVATE myproj_project_options myproj_project_warning
target_link_system_libraries(lib2 PRIVATE fmt::fmt Eigen3::Eigen)
target_link_system_libraries(lib2 PRIVATE mythirdpartylib)

add_test_config(common
DEPENDENCIES_CONFIG
ut

SYSTEM_LIBRARIES
Boost::ut
)

add_library_test(lib lib CONFIGS common SOURCES tests/mylib/lib.cpp)
add_library_test(lib2 lib CONFIGS common SOURCES tests/mylib2/lib.cpp)

# package everything automatically
package_project(
# NAME
Expand Down
9 changes: 9 additions & 0 deletions tests/myproj/tests/mylib/lib.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#include "mylib/lib.hpp"

#include <boost/ut.hpp>

int main() { // NOLINT(bugprone-exception-escape)
using namespace boost::ut; // NOLINT(*using-namespace*)

"lib"_test = []() { expect(some_fun() == 0); };

Check warning on line 8 in tests/myproj/tests/mylib/lib.cpp

View workflow job for this annotation

GitHub Actions / Test (macos-12, llvm, true, true)

Condition 'some_fun()==0' is always true [knownConditionTrueFalse]

Check warning on line 8 in tests/myproj/tests/mylib/lib.cpp

View workflow job for this annotation

GitHub Actions / Test (macos-11, gcc, true, true)

Condition 'some_fun()==0' is always true [knownConditionTrueFalse]

Check warning on line 8 in tests/myproj/tests/mylib/lib.cpp

View workflow job for this annotation

GitHub Actions / Test (windows-2022, llvm, true, true)

Condition 'some_fun()==0' is always true [knownConditionTrueFalse]
}
9 changes: 9 additions & 0 deletions tests/myproj/tests/mylib2/lib.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#include "mylib2/lib.hpp"

#include <boost/ut.hpp>

int main() { // NOLINT(bugprone-exception-escape)
using namespace boost::ut; // NOLINT(*using-namespace*)

"lib"_test = []() { expect(some_fun2() == 0); };
}
4 changes: 4 additions & 0 deletions tests/myproj/vcpkg.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@
{
"name": "fmt",
"version>=": "8.1.1"
},
{
"name": "bext-ut",
"version>=": "1.1.9"
}
]
}

0 comments on commit c50e227

Please sign in to comment.