diff options
Diffstat (limited to 't')
-rw-r--r-- | t/helper/test-tool.c | 27 | ||||
-rw-r--r-- | t/helper/test-tool.h | 4 |
2 files changed, 31 insertions, 0 deletions
diff --git a/t/helper/test-tool.c b/t/helper/test-tool.c new file mode 100644 index 0000000000..da1dd6621c --- /dev/null +++ b/t/helper/test-tool.c @@ -0,0 +1,27 @@ +#include "git-compat-util.h" +#include "test-tool.h" + +struct test_cmd { + const char *name; + int (*fn)(int argc, const char **argv); +}; + +static struct test_cmd cmds[] = { +}; + +int cmd_main(int argc, const char **argv) +{ + int i; + + if (argc < 2) + die("I need a test name!"); + + for (i = 0; i < ARRAY_SIZE(cmds); i++) { + if (!strcmp(cmds[i].name, argv[1])) { + argv++; + argc--; + return cmds[i].fn(argc, argv); + } + } + die("There is no test named '%s'", argv[1]); +} diff --git a/t/helper/test-tool.h b/t/helper/test-tool.h new file mode 100644 index 0000000000..6ce57ae0cc --- /dev/null +++ b/t/helper/test-tool.h @@ -0,0 +1,4 @@ +#ifndef __TEST_TOOL_H__ +#define __TEST_TOOL_H__ + +#endif |