1
0
Fork 0
mirror of https://github.com/git/git.git synced 2024-05-29 00:26:12 +02:00
git/t/helper/test-tool.c
Nguyễn Thái Ngọc Duy 9080e75fbc t/helper: merge (unused) test-match-trees into test-tool
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2018-03-27 08:45:47 -07:00

43 lines
1001 B
C

#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[] = {
{ "chmtime", cmd__chmtime },
{ "config", cmd__config },
{ "ctype", cmd__ctype },
{ "date", cmd__date },
{ "delta", cmd__delta },
{ "drop-caches", cmd__drop_caches },
{ "dump-cache-tree", cmd__dump_cache_tree },
{ "dump-split-index", cmd__dump_split_index },
{ "example-decorate", cmd__example_decorate },
{ "genrandom", cmd__genrandom },
{ "hashmap", cmd__hashmap },
{ "index-version", cmd__index_version },
{ "lazy-init-name-hash", cmd__lazy_init_name_hash },
{ "match-trees", cmd__match_trees },
{ "sha1", cmd__sha1 },
};
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]);
}