-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Revise testing system to make it easier to add new tests #50
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @BrendanKKrueger this is a needed improvement!
test/CMakeLists.txt
Outdated
|
||
target_link_libraries(test_portsofcall | ||
add_executable(test_main test_main.cpp) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would prefer if the test executable was still named test_portsofcall
add_executable(test_main test_main.cpp) | |
add_executable(test_portsofcall test_main.cpp) |
though maybe this suggests the test_portsofcall.cpp
file should be called something like test_portability.cpp
or something
test/CMakeLists.txt
Outdated
|
||
target_link_libraries(test_portsofcall | ||
add_executable(test_main test_main.cpp) | ||
target_link_libraries(test_main |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
target_link_libraries(test_main | |
target_link_libraries(test_portsofcall |
test/CMakeLists.txt
Outdated
PRIVATE | ||
ports-of-call::ports-of-call | ||
portsofcall_iface | ||
) | ||
|
||
include(Catch) | ||
catch_discover_tests(test_portsofcall) | ||
catch_discover_tests(test_main) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
catch_discover_tests(test_main) | |
catch_discover_tests(test_portsofcall) |
test/CMakeLists.txt
Outdated
|
||
target_sources(test_main PRIVATE test_portsofcall.cpp) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
target_sources(test_main PRIVATE test_portsofcall.cpp) | |
target_sources(test_portsofcall PRIVATE test_portsofcall.cpp) |
Feel free to push back on my suggestions here. I'm happy to merge as is. |
…ng test_main.cpp because that file is really just doing all the compilation for main.
I migrated us to catch2 v3 and added a fetch content line to the cmake so we can get catch even if it's not available via |
PR Summary
In #48 I did a very hacky job of adding new tests, and @Yurlungur rightly pointed out that it's not ideal. There could be a variety of ways to handle this, but I stole shamelessly from Singe to propose a new way to handle new unit test files. Now new files should only need to be added to the
target_sources
command at the end oftest/CMakeLists.txt
.PR Checklist