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