t/helper: merge test-chmtime into test-tool
[git] / t / helper / test-tool.c
1 #include "git-compat-util.h"
2 #include "test-tool.h"
3
4 struct test_cmd {
5         const char *name;
6         int (*fn)(int argc, const char **argv);
7 };
8
9 static struct test_cmd cmds[] = {
10         { "chmtime", cmd__chmtime },
11 };
12
13 int cmd_main(int argc, const char **argv)
14 {
15         int i;
16
17         if (argc < 2)
18                 die("I need a test name!");
19
20         for (i = 0; i < ARRAY_SIZE(cmds); i++) {
21                 if (!strcmp(cmds[i].name, argv[1])) {
22                         argv++;
23                         argc--;
24                         return cmds[i].fn(argc, argv);
25                 }
26         }
27         die("There is no test named '%s'", argv[1]);
28 }