xmake-io / xmake

🔥 A cross-platform build utility based on Lua
https://xmake.io
Apache License 2.0
9.92k stars 777 forks source link

Add explicit support for testing: `xmake test` #3381

Closed paul-reilly closed 1 year ago

paul-reilly commented 1 year ago

Is your feature request related to a problem? Please describe.

This is related to target name clashes described in #3380 where multiple subdirectories have a tests target.

Describe the solution you'd like

xmake should have the facility to easily compile and execute tests:

xmake test [target dir or more specific target] [options]

Related to the target clashes described in #3380, when including subdirectories where the author was not aware that defining tests was a going to be a thing in the future, we could have something like :

includes("external/**/xmake.lua", { test_targets = { "tests", "mytests" }})

... which would stop those targets being built as part of a non-test build.

cargo test is highly recommended and since xmake supports languages with integrated testing already:

For complete testing in C/C++:

Describe alternatives you've considered

No response

Additional context

No response