]>
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[] = { | |
0e496492 | 10 | { "chmtime", cmd__chmtime }, |
0e2678af | 11 | { "config", cmd__config }, |
e4998944 | 12 | { "ctype", cmd__ctype }, |
64eb82fe | 13 | { "lazy-init-name-hash", cmd__lazy_init_name_hash }, |
dae2ff9b | 14 | { "sha1", cmd__sha1 }, |
efd71f89 NTND |
15 | }; |
16 | ||
17 | int cmd_main(int argc, const char **argv) | |
18 | { | |
19 | int i; | |
20 | ||
21 | if (argc < 2) | |
22 | die("I need a test name!"); | |
23 | ||
24 | for (i = 0; i < ARRAY_SIZE(cmds); i++) { | |
25 | if (!strcmp(cmds[i].name, argv[1])) { | |
26 | argv++; | |
27 | argc--; | |
28 | return cmds[i].fn(argc, argv); | |
29 | } | |
30 | } | |
31 | die("There is no test named '%s'", argv[1]); | |
32 | } |