Skip to content

Commit

Permalink
Add an executable test with args in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
FeignClaims committed Mar 1, 2024
1 parent da02889 commit f62419d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
3 changes: 3 additions & 0 deletions tests/myproj/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,9 @@ add_subdirectory(libs)
## tests
enable_testing()
add_executable_test(main no_arg)
add_executable_test(main with_arg
EXECUTE_ARGS hello world
)

# Header-only library
add_library(lib INTERFACE)
Expand Down
6 changes: 5 additions & 1 deletion tests/myproj/src/main/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,11 @@
#include <cstdint>

Check warning on line 15 in tests/myproj/src/main/main.cpp

View workflow job for this annotation

GitHub Actions / Test (ubuntu-22.04, gcc, true, true)

included header cstdint is not used directly [misc-include-cleaner]

Check warning on line 15 in tests/myproj/src/main/main.cpp

View workflow job for this annotation

GitHub Actions / Test (ubuntu-22.04, llvm, true, true)

included header cstdint is not used directly [misc-include-cleaner]

Check warning on line 15 in tests/myproj/src/main/main.cpp

View workflow job for this annotation

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

included header cstdint is not used directly [misc-include-cleaner]
#include <cstring>

Check warning on line 16 in tests/myproj/src/main/main.cpp

View workflow job for this annotation

GitHub Actions / Test (ubuntu-22.04, gcc, true, true)

included header cstring is not used directly [misc-include-cleaner]

Check warning on line 16 in tests/myproj/src/main/main.cpp

View workflow job for this annotation

GitHub Actions / Test (ubuntu-22.04, llvm, true, true)

included header cstring is not used directly [misc-include-cleaner]

Check warning on line 16 in tests/myproj/src/main/main.cpp

View workflow job for this annotation

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

included header cstring is not used directly [misc-include-cleaner]

int main() {
int main(int argc, char* argv[]) {
if (argc > 1) {
fmt::print("[{}]", fmt::join(argv + 1, argv + argc, ", "));
}

fmt::print("Hello from fmt{}", "!");

Eigen::VectorXd eigen_vec = Eigen::Vector3d(1, 2, 3);
Expand Down

0 comments on commit f62419d

Please sign in to comment.