Skip to content

Commit aa218df

Browse files
pcloudsgitster
authored andcommitted
t/helper: merge test-sha1-array into test-tool
Signed-off-by: Nguyễn Thái Ngọc Duy <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent ff5fb8b commit aa218df

File tree

5 files changed

+13
-10
lines changed

5 files changed

+13
-10
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -677,6 +677,7 @@ TEST_BUILTINS_OBJS += test-regex.o
677677
TEST_BUILTINS_OBJS += test-revision-walking.o
678678
TEST_BUILTINS_OBJS += test-run-command.o
679679
TEST_BUILTINS_OBJS += test-scrap-cache-tree.o
680+
TEST_BUILTINS_OBJS += test-sha1-array.o
680681
TEST_BUILTINS_OBJS += test-sha1.o
681682

682683
TEST_PROGRAMS_NEED_X += test-dump-fsmonitor
@@ -685,7 +686,6 @@ TEST_PROGRAMS_NEED_X += test-fake-ssh
685686
TEST_PROGRAMS_NEED_X += test-line-buffer
686687
TEST_PROGRAMS_NEED_X += test-parse-options
687688
TEST_PROGRAMS_NEED_X += test-write-cache
688-
TEST_PROGRAMS_NEED_X += test-sha1-array
689689
TEST_PROGRAMS_NEED_X += test-sigchain
690690
TEST_PROGRAMS_NEED_X += test-strcmp-offset
691691
TEST_PROGRAMS_NEED_X += test-string-list

t/helper/test-sha1-array.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#include "test-tool.h"
12
#include "cache.h"
23
#include "sha1-array.h"
34

@@ -7,7 +8,7 @@ static int print_oid(const struct object_id *oid, void *data)
78
return 0;
89
}
910

10-
int cmd_main(int argc, const char **argv)
11+
int cmd__sha1_array(int argc, const char **argv)
1112
{
1213
struct oid_array array = OID_ARRAY_INIT;
1314
struct strbuf line = STRBUF_INIT;

t/helper/test-tool.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ static struct test_cmd cmds[] = {
3232
{ "revision-walking", cmd__revision_walking },
3333
{ "run-command", cmd__run_command },
3434
{ "scrap-cache-tree", cmd__scrap_cache_tree },
35+
{ "sha1-array", cmd__sha1_array },
3536
{ "sha1", cmd__sha1 },
3637
};
3738

t/helper/test-tool.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ int cmd__regex(int argc, const char **argv);
2626
int cmd__revision_walking(int argc, const char **argv);
2727
int cmd__run_command(int argc, const char **argv);
2828
int cmd__scrap_cache_tree(int argc, const char **argv);
29+
int cmd__sha1_array(int argc, const char **argv);
2930
int cmd__sha1(int argc, const char **argv);
3031

3132
#endif

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
echo20 append 88 44 aa 55 &&
2020
echo for_each_unique
21-
} | test-sha1-array >actual &&
21+
} | test-tool sha1-array >actual &&
2222
test_cmp expect actual
2323
'
2424

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

3535
test_expect_success 'lookup' '
3636
{
3737
echo20 append 88 44 aa 55 &&
3838
echo20 lookup 55
39-
} | test-sha1-array >actual &&
39+
} | test-tool sha1-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
echo20 append 88 44 aa 55 &&
4747
echo20 lookup 33
48-
} | test-sha1-array >actual &&
48+
} | test-tool sha1-array >actual &&
4949
n=$(cat actual) &&
5050
test "$n" -lt 0
5151
'
@@ -55,7 +55,7 @@ test_expect_success 'lookup with duplicates' '
5555
echo20 append 88 44 aa 55 &&
5656
echo20 append 88 44 aa 55 &&
5757
echo20 lookup 55
58-
} | test-sha1-array >actual &&
58+
} | test-tool sha1-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
echo20 append 88 44 aa 55 &&
6767
echo20 append 88 44 aa 55 &&
6868
echo20 lookup 66
69-
} | test-sha1-array >actual &&
69+
} | test-tool sha1-array >actual &&
7070
n=$(cat actual) &&
7171
test "$n" -lt 0
7272
'
@@ -76,7 +76,7 @@ test_expect_success 'lookup with almost duplicate values' '
7676
echo "append 5555555555555555555555555555555555555555" &&
7777
echo "append 555555555555555555555555555555555555555f" &&
7878
echo20 lookup 55
79-
} | test-sha1-array >actual &&
79+
} | test-tool sha1-array >actual &&
8080
n=$(cat actual) &&
8181
test "$n" -eq 0
8282
'
@@ -85,7 +85,7 @@ test_expect_success 'lookup with single duplicate value' '
8585
{
8686
echo20 append 55 55 &&
8787
echo20 lookup 55
88-
} | test-sha1-array >actual &&
88+
} | test-tool sha1-array >actual &&
8989
n=$(cat actual) &&
9090
test "$n" -ge 0 &&
9191
test "$n" -le 1

0 commit comments

Comments
 (0)