mirror of
https://github.com/RGBCube/serenity
synced 2025-05-22 19:05:07 +00:00

If a unit tests defines a `deps` array, the unit test template would have tried to overwrite it (and it is actually an error to overwrite a non-empty list with another non-empty list).
30 lines
816 B
Text
30 lines
816 B
Text
template("unittest") {
|
|
executable(target_name) {
|
|
has_custom_main = false
|
|
use_js_main = false
|
|
|
|
# Foward everything (has_custom_main if set; configs, sources, deps, ...).
|
|
forward_variables_from(invoker, "*")
|
|
assert(!defined(invoker.output_dir), "cannot set unittest output_dir")
|
|
assert(!defined(invoker.testonly), "cannot set unittest testonly")
|
|
|
|
if (!defined(invoker.deps)) {
|
|
deps = []
|
|
}
|
|
|
|
deps += [ "//AK" ]
|
|
if (has_custom_main) {
|
|
deps += [ "//Userland/Libraries/LibTest" ]
|
|
} else if (use_js_main) {
|
|
deps += [ "//Userland/Libraries/LibTest:test_js_main" ]
|
|
} else {
|
|
deps += [ "//Userland/Libraries/LibTest:test_main" ]
|
|
}
|
|
|
|
if (current_os != "serenity") {
|
|
deps += [ "//Userland/Libraries/LibCore" ]
|
|
}
|
|
|
|
testonly = true
|
|
}
|
|
}
|