t/helper: merge test-sha1-array 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>
Nguyễn Thái Ngọc Duy committed
Mar 24, 2018 at 08:44 UTC
aa218dffcc00a8c5f7cccba79c3441addecabb50
5 files changed
+13
-10
Makefile
+1
-1
@@ -677,6 +677,7 @@ TEST_BUILTINS_OBJS += test-regex.o
677
TEST_BUILTINS_OBJS += test-revision-walking.o
678
TEST_BUILTINS_OBJS += test-run-command.o
679
TEST_BUILTINS_OBJS += test-scrap-cache-tree.o
680
+TEST_BUILTINS_OBJS += test-sha1-array.o
681
TEST_BUILTINS_OBJS += test-sha1.o
682
683
TEST_PROGRAMS_NEED_X += test-dump-fsmonitor
@@ -685,7 +686,6 @@ TEST_PROGRAMS_NEED_X += test-fake-ssh
686
TEST_PROGRAMS_NEED_X += test-line-buffer
687
TEST_PROGRAMS_NEED_X += test-parse-options
688
TEST_PROGRAMS_NEED_X += test-write-cache
688
-TEST_PROGRAMS_NEED_X += test-sha1-array
689
TEST_PROGRAMS_NEED_X += test-sigchain
690
TEST_PROGRAMS_NEED_X += test-strcmp-offset
691
TEST_PROGRAMS_NEED_X += test-string-list
t/helper/test-sha1-array.c
+2
-1
@@ -1,3 +1,4 @@
1
+#include "test-tool.h"
2
#include "cache.h"
3
#include "sha1-array.h"
4
@@ -7,7 +8,7 @@ static int print_oid(const struct object_id *oid, void *data)
8
return 0;
9
}
10
10
-int cmd_main(int argc, const char **argv)
11
+int cmd__sha1_array(int argc, const char **argv)
12
{
13
struct oid_array array = OID_ARRAY_INIT;
14
struct strbuf line = STRBUF_INIT;
t/helper/test-tool.c
+1
@@ -32,6 +32,7 @@ static struct test_cmd cmds[] = {
32
{ "revision-walking", cmd__revision_walking },
33
{ "run-command", cmd__run_command },
34
{ "scrap-cache-tree", cmd__scrap_cache_tree },
35
+ { "sha1-array", cmd__sha1_array },
36
{ "sha1", cmd__sha1 },
37
};
38
t/helper/test-tool.h
+1
@@ -26,6 +26,7 @@ int cmd__regex(int argc, const char **argv);
26
int cmd__revision_walking(int argc, const char **argv);
27
int cmd__run_command(int argc, const char **argv);
28
int cmd__scrap_cache_tree(int argc, const char **argv);
29
+int cmd__sha1_array(int argc, const char **argv);
30
int cmd__sha1(int argc, const char **argv);
31
32
#endif
t/t0064-sha1-array.sh
+8
-8
@@ -18,7 +18,7 @@ test_expect_success 'ordered enumeration' '
18
{
19
echo20 append 88 44 aa 55 &&
20
echo for_each_unique
21
- } | test-sha1-array >actual &&
21
+ } | test-tool sha1-array >actual &&
22
test_cmp expect actual
23
'
24
@@ -28,7 +28,7 @@ test_expect_success 'ordered enumeration with duplicate suppression' '
28
echo20 append 88 44 aa 55 &&
29
echo20 append 88 44 aa 55 &&
30
echo for_each_unique
31
- } | test-sha1-array >actual &&
31
+ } | test-tool sha1-array >actual &&
32
test_cmp expect actual
33
'
34
@@ -36,7 +36,7 @@ test_expect_success 'lookup' '
36
{
37
echo20 append 88 44 aa 55 &&
38
echo20 lookup 55
39
- } | test-sha1-array >actual &&
39
+ } | test-tool sha1-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
echo20 append 88 44 aa 55 &&
47
echo20 lookup 33
48
- } | test-sha1-array >actual &&
48
+ } | test-tool sha1-array >actual &&
49
n=$(cat actual) &&
50
test "$n" -lt 0
51
'
@@ -55,7 +55,7 @@ test_expect_success 'lookup with duplicates' '
55
echo20 append 88 44 aa 55 &&
56
echo20 append 88 44 aa 55 &&
57
echo20 lookup 55
58
- } | test-sha1-array >actual &&
58
+ } | test-tool sha1-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
echo20 append 88 44 aa 55 &&
67
echo20 append 88 44 aa 55 &&
68
echo20 lookup 66
69
- } | test-sha1-array >actual &&
69
+ } | test-tool sha1-array >actual &&
70
n=$(cat actual) &&
71
test "$n" -lt 0
72
'
@@ -76,7 +76,7 @@ test_expect_success 'lookup with almost duplicate values' '
76
echo "append 5555555555555555555555555555555555555555" &&
77
echo "append 555555555555555555555555555555555555555f" &&
78
echo20 lookup 55
79
- } | test-sha1-array >actual &&
79
+ } | test-tool sha1-array >actual &&
80
n=$(cat actual) &&
81
test "$n" -eq 0
82
'
@@ -85,7 +85,7 @@ test_expect_success 'lookup with single duplicate value' '
85
{
86
echo20 append 55 55 &&
87
echo20 lookup 55
88
- } | test-sha1-array >actual &&
88
+ } | test-tool sha1-array >actual &&
89
n=$(cat actual) &&
90
test "$n" -ge 0 &&
91
test "$n" -le 1