Skip to content

Commit ed4b804

Browse files
peffgitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent fe299ec commit ed4b804

File tree

5 files changed

+14
-14
lines changed

5 files changed

+14
-14
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -738,7 +738,7 @@ TEST_BUILTINS_OBJS += test-run-command.o
738738
TEST_BUILTINS_OBJS += test-scrap-cache-tree.o
739739
TEST_BUILTINS_OBJS += test-serve-v2.o
740740
TEST_BUILTINS_OBJS += test-sha1.o
741-
TEST_BUILTINS_OBJS += test-sha1-array.o
741+
TEST_BUILTINS_OBJS += test-oid-array.o
742742
TEST_BUILTINS_OBJS += test-sha256.o
743743
TEST_BUILTINS_OBJS += test-sigchain.o
744744
TEST_BUILTINS_OBJS += test-strcmp-offset.o

t/helper/test-sha1-array.c renamed to t/helper/test-oid-array.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ static int print_oid(const struct object_id *oid, void *data)
88
return 0;
99
}
1010

11-
int cmd__sha1_array(int argc, const char **argv)
11+
int cmd__oid_array(int argc, const char **argv)
1212
{
1313
struct oid_array array = OID_ARRAY_INIT;
1414
struct strbuf line = STRBUF_INIT;
@@ -19,11 +19,11 @@ int cmd__sha1_array(int argc, const char **argv)
1919

2020
if (skip_prefix(line.buf, "append ", &arg)) {
2121
if (get_oid_hex(arg, &oid))
22-
die("not a hexadecimal SHA1: %s", arg);
22+
die("not a hexadecimal oid: %s", arg);
2323
oid_array_append(&array, &oid);
2424
} else if (skip_prefix(line.buf, "lookup ", &arg)) {
2525
if (get_oid_hex(arg, &oid))
26-
die("not a hexadecimal SHA1: %s", arg);
26+
die("not a hexadecimal oid: %s", arg);
2727
printf("%d\n", oid_array_lookup(&array, &oid));
2828
} else if (!strcmp(line.buf, "clear"))
2929
oid_array_clear(&array);

t/helper/test-tool.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ static struct test_cmd cmds[] = {
3636
{ "match-trees", cmd__match_trees },
3737
{ "mergesort", cmd__mergesort },
3838
{ "mktemp", cmd__mktemp },
39+
{ "oid-array", cmd__oid_array },
3940
{ "oidmap", cmd__oidmap },
4041
{ "online-cpus", cmd__online_cpus },
4142
{ "parse-options", cmd__parse_options },
@@ -56,7 +57,6 @@ static struct test_cmd cmds[] = {
5657
{ "scrap-cache-tree", cmd__scrap_cache_tree },
5758
{ "serve-v2", cmd__serve_v2 },
5859
{ "sha1", cmd__sha1 },
59-
{ "sha1-array", cmd__sha1_array },
6060
{ "sha256", cmd__sha256 },
6161
{ "sigchain", cmd__sigchain },
6262
{ "strcmp-offset", cmd__strcmp_offset },

t/helper/test-tool.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ int cmd__run_command(int argc, const char **argv);
4646
int cmd__scrap_cache_tree(int argc, const char **argv);
4747
int cmd__serve_v2(int argc, const char **argv);
4848
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);
5050
int cmd__sha256(int argc, const char **argv);
5151
int cmd__sigchain(int argc, const char **argv);
5252
int cmd__strcmp_offset(int argc, const char **argv);

t/t0064-sha1-array.sh

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ test_expect_success 'ordered enumeration' '
1818
{
1919
echoid append 88 44 aa 55 &&
2020
echo for_each_unique
21-
} | test-tool sha1-array >actual &&
21+
} | test-tool oid-array >actual &&
2222
test_cmp expect actual
2323
'
2424

@@ -28,15 +28,15 @@ test_expect_success 'ordered enumeration with duplicate suppression' '
2828
echoid append 88 44 aa 55 &&
2929
echoid append 88 44 aa 55 &&
3030
echo for_each_unique
31-
} | test-tool sha1-array >actual &&
31+
} | test-tool oid-array >actual &&
3232
test_cmp expect actual
3333
'
3434

3535
test_expect_success 'lookup' '
3636
{
3737
echoid append 88 44 aa 55 &&
3838
echoid lookup 55
39-
} | test-tool sha1-array >actual &&
39+
} | test-tool oid-array >actual &&
4040
n=$(cat actual) &&
4141
test "$n" -eq 1
4242
'
@@ -45,7 +45,7 @@ test_expect_success 'lookup non-existing entry' '
4545
{
4646
echoid append 88 44 aa 55 &&
4747
echoid lookup 33
48-
} | test-tool sha1-array >actual &&
48+
} | test-tool oid-array >actual &&
4949
n=$(cat actual) &&
5050
test "$n" -lt 0
5151
'
@@ -55,7 +55,7 @@ test_expect_success 'lookup with duplicates' '
5555
echoid append 88 44 aa 55 &&
5656
echoid append 88 44 aa 55 &&
5757
echoid lookup 55
58-
} | test-tool sha1-array >actual &&
58+
} | test-tool oid-array >actual &&
5959
n=$(cat actual) &&
6060
test "$n" -ge 2 &&
6161
test "$n" -le 3
@@ -66,7 +66,7 @@ test_expect_success 'lookup non-existing entry with duplicates' '
6666
echoid append 88 44 aa 55 &&
6767
echoid append 88 44 aa 55 &&
6868
echoid lookup 66
69-
} | test-tool sha1-array >actual &&
69+
} | test-tool oid-array >actual &&
7070
n=$(cat actual) &&
7171
test "$n" -lt 0
7272
'
@@ -81,7 +81,7 @@ test_expect_success 'lookup with almost duplicate values' '
8181
echo "append $id1" &&
8282
echo "append $id2" &&
8383
echoid lookup 55
84-
} | test-tool sha1-array >actual &&
84+
} | test-tool oid-array >actual &&
8585
n=$(cat actual) &&
8686
test "$n" -eq 0
8787
'
@@ -90,7 +90,7 @@ test_expect_success 'lookup with single duplicate value' '
9090
{
9191
echoid append 55 55 &&
9292
echoid lookup 55
93-
} | test-tool sha1-array >actual &&
93+
} | test-tool oid-array >actual &&
9494
n=$(cat actual) &&
9595
test "$n" -ge 0 &&
9696
test "$n" -le 1

0 commit comments

Comments
 (0)