]>
Commit | Line | Data |
---|---|---|
efd71f89 NTND |
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 | }; | |
11 | ||
12 | int cmd_main(int argc, const char **argv) | |
13 | { | |
14 | int i; | |
15 | ||
16 | if (argc < 2) | |
17 | die("I need a test name!"); | |
18 | ||
19 | for (i = 0; i < ARRAY_SIZE(cmds); i++) { | |
20 | if (!strcmp(cmds[i].name, argv[1])) { | |
21 | argv++; | |
22 | argc--; | |
23 | return cmds[i].fn(argc, argv); | |
24 | } | |
25 | } | |
26 | die("There is no test named '%s'", argv[1]); | |
27 | } |