test-tool: rename sha1-array to oid-array
This matches the actual data structure name, as well as the source file that contains the code we're testing. The test scripts need updating to use the new name, as well. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Jeff King committed
Mar 30, 2020 at 10:04 UTC
ed4b804e46b177203b4035cf5a1271f50724ba1c
5 files changed
+14
-14
Makefile
+1
-1
@@ -738,7 +738,7 @@ TEST_BUILTINS_OBJS += test-run-command.o
738
TEST_BUILTINS_OBJS += test-scrap-cache-tree.o
739
TEST_BUILTINS_OBJS += test-serve-v2.o
740
TEST_BUILTINS_OBJS += test-sha1.o
741
-TEST_BUILTINS_OBJS += test-sha1-array.o
741
+TEST_BUILTINS_OBJS += test-oid-array.o
742
TEST_BUILTINS_OBJS += test-sha256.o
743
TEST_BUILTINS_OBJS += test-sigchain.o
744
TEST_BUILTINS_OBJS += test-strcmp-offset.o
t/helper/test-oid-array.c
renamed
+3
-3
@@ -8,7 +8,7 @@ static int print_oid(const struct object_id *oid, void *data)
8
return 0;
9
}
10
11
-int cmd__sha1_array(int argc, const char **argv)
11
+int cmd__oid_array(int argc, const char **argv)
12
{
13
struct oid_array array = OID_ARRAY_INIT;
14
struct strbuf line = STRBUF_INIT;
@@ -19,11 +19,11 @@ int cmd__sha1_array(int argc, const char **argv)
19
20
if (skip_prefix(line.buf, "append ", &arg)) {
21
if (get_oid_hex(arg, &oid))
22
- die("not a hexadecimal SHA1: %s", arg);
22
+ die("not a hexadecimal oid: %s", arg);
23
oid_array_append(&array, &oid);
24
} else if (skip_prefix(line.buf, "lookup ", &arg)) {
25
if (get_oid_hex(arg, &oid))
26
- die("not a hexadecimal SHA1: %s", arg);
26
+ die("not a hexadecimal oid: %s", arg);
27
printf("%d\n", oid_array_lookup(&array, &oid));
28
} else if (!strcmp(line.buf, "clear"))
29
oid_array_clear(&array);
t/helper/test-tool.c
+1
-1
@@ -36,6 +36,7 @@ static struct test_cmd cmds[] = {
36
{ "match-trees", cmd__match_trees },
37
{ "mergesort", cmd__mergesort },
38
{ "mktemp", cmd__mktemp },
39
+ { "oid-array", cmd__oid_array },
40
{ "oidmap", cmd__oidmap },
41
{ "online-cpus", cmd__online_cpus },
42
{ "parse-options", cmd__parse_options },
@@ -56,7 +57,6 @@ static struct test_cmd cmds[] = {
57
{ "scrap-cache-tree", cmd__scrap_cache_tree },
58
{ "serve-v2", cmd__serve_v2 },
59
{ "sha1", cmd__sha1 },
59
- { "sha1-array", cmd__sha1_array },
60
{ "sha256", cmd__sha256 },
61
{ "sigchain", cmd__sigchain },
62
{ "strcmp-offset", cmd__strcmp_offset },
t/helper/test-tool.h
+1
-1
@@ -46,7 +46,7 @@ int cmd__run_command(int argc, const char **argv);
46
int cmd__scrap_cache_tree(int argc, const char **argv);
47
int cmd__serve_v2(int argc, const char **argv);
48
int cmd__sha1(int argc, const char **argv);
49
-int cmd__sha1_array(int argc, const char **argv);
49
+int cmd__oid_array(int argc, const char **argv);
50
int cmd__sha256(int argc, const char **argv);
51
int cmd__sigchain(int argc, const char **argv);
52
int cmd__strcmp_offset(int argc, const char **argv);
t/t0064-sha1-array.sh
+8
-8
@@ -18,7 +18,7 @@ test_expect_success 'ordered enumeration' '
18
{
19
echoid append 88 44 aa 55 &&
20
echo for_each_unique
21
- } | test-tool sha1-array >actual &&
21
+ } | test-tool oid-array >actual &&
22
test_cmp expect actual
23
'
24
@@ -28,7 +28,7 @@ test_expect_success 'ordered enumeration with duplicate suppression' '
28
echoid append 88 44 aa 55 &&
29
echoid append 88 44 aa 55 &&
30
echo for_each_unique
31
- } | test-tool sha1-array >actual &&
31
+ } | test-tool oid-array >actual &&
32
test_cmp expect actual
33
'
34
@@ -36,7 +36,7 @@ test_expect_success 'lookup' '
36
{
37
echoid append 88 44 aa 55 &&
38
echoid lookup 55
39
- } | test-tool sha1-array >actual &&
39
+ } | test-tool oid-array >actual &&
40
n=$(cat actual) &&
41
test "$n" -eq 1
42
'
@@ -45,7 +45,7 @@ test_expect_success 'lookup non-existing entry' '
45
{
46
echoid append 88 44 aa 55 &&
47
echoid lookup 33
48
- } | test-tool sha1-array >actual &&
48
+ } | test-tool oid-array >actual &&
49
n=$(cat actual) &&
50
test "$n" -lt 0
51
'
@@ -55,7 +55,7 @@ test_expect_success 'lookup with duplicates' '
55
echoid append 88 44 aa 55 &&
56
echoid append 88 44 aa 55 &&
57
echoid lookup 55
58
- } | test-tool sha1-array >actual &&
58
+ } | test-tool oid-array >actual &&
59
n=$(cat actual) &&
60
test "$n" -ge 2 &&
61
test "$n" -le 3
@@ -66,7 +66,7 @@ test_expect_success 'lookup non-existing entry with duplicates' '
66
echoid append 88 44 aa 55 &&
67
echoid append 88 44 aa 55 &&
68
echoid lookup 66
69
- } | test-tool sha1-array >actual &&
69
+ } | test-tool oid-array >actual &&
70
n=$(cat actual) &&
71
test "$n" -lt 0
72
'
@@ -81,7 +81,7 @@ test_expect_success 'lookup with almost duplicate values' '
81
echo "append $id1" &&
82
echo "append $id2" &&
83
echoid lookup 55
84
- } | test-tool sha1-array >actual &&
84
+ } | test-tool oid-array >actual &&
85
n=$(cat actual) &&
86
test "$n" -eq 0
87
'
@@ -90,7 +90,7 @@ test_expect_success 'lookup with single duplicate value' '
90
{
91
echoid append 55 55 &&
92
echoid lookup 55
93
- } | test-tool sha1-array >actual &&
93
+ } | test-tool oid-array >actual &&
94
n=$(cat actual) &&
95
test "$n" -ge 0 &&
96
test "$n" -le 1