diff --git a/tests/create_test.py b/tests/create_test.py new file mode 100644 index 00000000000..5a0439084f5 --- /dev/null +++ b/tests/create_test.py @@ -0,0 +1,132 @@ +#!/usr/bin/env python3 + +import argparse +import os +import re +import sys +from subprocess import call + + +def main(): + # Change to the directory where the script is located, + # so that the script can be run from any location. + os.chdir(os.path.dirname(os.path.realpath(__file__))) + + parser = argparse.ArgumentParser(description="Creates a new unit test file.") + parser.add_argument("name", type=str, help="The unit test name in PascalCase notation") + parser.add_argument( + "path", + type=str, + nargs="?", + help="The path to the unit test file relative to the tests folder (default: .)", + default=".", + ) + parser.add_argument( + "-i", + "--invasive", + action="store_true", + help="if set, the script will automatically insert the include directive in test_main.cpp. Use with caution!", + ) + args = parser.parse_args() + + snake_case_regex = re.compile(r"(?