1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-12 13:20:55 +00:00

Enable support for C++ modules tests

Modules-specific tests can be written under respective module folders.
Each module should have "tests" folder created with the tests implemented
as `doctest` headers, so they can be collected by the buildsystem and
included directly in `tests/test_main.cpp` to be compiled.
This commit is contained in:
Andrii Doroshenko (Xrayez)
2020-07-26 14:46:44 +03:00
parent 9856c8fda4
commit 60f53140b8
3 changed files with 24 additions and 2 deletions

View File

@@ -12,5 +12,16 @@ def generate_modules_enabled(target, source, env):
f.write("#define %s\n" % ("MODULE_" + module.upper() + "_ENABLED"))
def generate_modules_tests(target, source, env):
import os
import glob
with open(target[0].path, "w") as f:
for name, path in env.module_list.items():
headers = glob.glob(os.path.join(path, "tests", "*.h"))
for h in headers:
f.write('#include "%s"\n' % (os.path.normpath(h)))
if __name__ == "__main__":
subprocess_main(globals())