Skip to content

Commit c932a5f

Browse files
pcloudsgitster
authored andcommitted
t/helper: merge test-string-list 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 1a5f3d7 commit c932a5f

File tree

6 files changed

+30
-27
lines changed

6 files changed

+30
-27
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -681,14 +681,14 @@ TEST_BUILTINS_OBJS += test-sha1-array.o
681681
TEST_BUILTINS_OBJS += test-sha1.o
682682
TEST_BUILTINS_OBJS += test-sigchain.o
683683
TEST_BUILTINS_OBJS += test-strcmp-offset.o
684+
TEST_BUILTINS_OBJS += test-string-list.o
684685

685686
TEST_PROGRAMS_NEED_X += test-dump-fsmonitor
686687
TEST_PROGRAMS_NEED_X += test-dump-untracked-cache
687688
TEST_PROGRAMS_NEED_X += test-fake-ssh
688689
TEST_PROGRAMS_NEED_X += test-line-buffer
689690
TEST_PROGRAMS_NEED_X += test-parse-options
690691
TEST_PROGRAMS_NEED_X += test-write-cache
691-
TEST_PROGRAMS_NEED_X += test-string-list
692692
TEST_PROGRAMS_NEED_X += test-submodule-config
693693
TEST_PROGRAMS_NEED_X += test-subprocess
694694
TEST_PROGRAMS_NEED_X += test-svn-fe

t/helper/test-string-list.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 "string-list.h"
34

@@ -41,7 +42,7 @@ static int prefix_cb(struct string_list_item *item, void *cb_data)
4142
return starts_with(item->string, prefix);
4243
}
4344

44-
int cmd_main(int argc, const char **argv)
45+
int cmd__string_list(int argc, const char **argv)
4546
{
4647
if (argc == 5 && !strcmp(argv[1], "split")) {
4748
struct string_list list = STRING_LIST_INIT_DUP;

t/helper/test-tool.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ static struct test_cmd cmds[] = {
3636
{ "sha1", cmd__sha1 },
3737
{ "sigchain", cmd__sigchain },
3838
{ "strcmp-offset", cmd__strcmp_offset },
39+
{ "string-list", cmd__string_list },
3940
};
4041

4142
int cmd_main(int argc, const char **argv)

t/helper/test-tool.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,5 +30,6 @@ int cmd__sha1_array(int argc, const char **argv);
3030
int cmd__sha1(int argc, const char **argv);
3131
int cmd__sigchain(int argc, const char **argv);
3232
int cmd__strcmp_offset(int argc, const char **argv);
33+
int cmd__string_list(int argc, const char **argv);
3334

3435
#endif

t/perf/p0071-sort.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ test_perf 'sort(1)' '
1616
'
1717

1818
test_perf 'string_list_sort()' '
19-
test-string-list sort <unsorted >actual
19+
test-tool string-list sort <unsorted >actual
2020
'
2121

2222
test_expect_success 'string_list_sort() sorts like sort(1)' '

t/t0063-string-list.sh

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ test_description='Test string list functionality'
1010
test_split () {
1111
cat >expected &&
1212
test_expect_success "split $1 at $2, max $3" "
13-
test-string-list split '$1' '$2' '$3' >actual &&
13+
test-tool string-list split '$1' '$2' '$3' >actual &&
1414
test_cmp expected actual &&
15-
test-string-list split_in_place '$1' '$2' '$3' >actual &&
15+
test-tool string-list split_in_place '$1' '$2' '$3' >actual &&
1616
test_cmp expected actual
1717
"
1818
}
@@ -61,31 +61,31 @@ test_split ":" ":" "-1" <<EOF
6161
EOF
6262

6363
test_expect_success "test filter_string_list" '
64-
test "x-" = "x$(test-string-list filter - y)" &&
65-
test "x-" = "x$(test-string-list filter no y)" &&
66-
test yes = "$(test-string-list filter yes y)" &&
67-
test yes = "$(test-string-list filter no:yes y)" &&
68-
test yes = "$(test-string-list filter yes:no y)" &&
69-
test y1:y2 = "$(test-string-list filter y1:y2 y)" &&
70-
test y2:y1 = "$(test-string-list filter y2:y1 y)" &&
71-
test "x-" = "x$(test-string-list filter x1:x2 y)"
64+
test "x-" = "x$(test-tool string-list filter - y)" &&
65+
test "x-" = "x$(test-tool string-list filter no y)" &&
66+
test yes = "$(test-tool string-list filter yes y)" &&
67+
test yes = "$(test-tool string-list filter no:yes y)" &&
68+
test yes = "$(test-tool string-list filter yes:no y)" &&
69+
test y1:y2 = "$(test-tool string-list filter y1:y2 y)" &&
70+
test y2:y1 = "$(test-tool string-list filter y2:y1 y)" &&
71+
test "x-" = "x$(test-tool string-list filter x1:x2 y)"
7272
'
7373

7474
test_expect_success "test remove_duplicates" '
75-
test "x-" = "x$(test-string-list remove_duplicates -)" &&
76-
test "x" = "x$(test-string-list remove_duplicates "")" &&
77-
test a = "$(test-string-list remove_duplicates a)" &&
78-
test a = "$(test-string-list remove_duplicates a:a)" &&
79-
test a = "$(test-string-list remove_duplicates a:a:a:a:a)" &&
80-
test a:b = "$(test-string-list remove_duplicates a:b)" &&
81-
test a:b = "$(test-string-list remove_duplicates a:a:b)" &&
82-
test a:b = "$(test-string-list remove_duplicates a:b:b)" &&
83-
test a:b:c = "$(test-string-list remove_duplicates a:b:c)" &&
84-
test a:b:c = "$(test-string-list remove_duplicates a:a:b:c)" &&
85-
test a:b:c = "$(test-string-list remove_duplicates a:b:b:c)" &&
86-
test a:b:c = "$(test-string-list remove_duplicates a:b:c:c)" &&
87-
test a:b:c = "$(test-string-list remove_duplicates a:a:b:b:c:c)" &&
88-
test a:b:c = "$(test-string-list remove_duplicates a:a:a:b:b:b:c:c:c)"
75+
test "x-" = "x$(test-tool string-list remove_duplicates -)" &&
76+
test "x" = "x$(test-tool string-list remove_duplicates "")" &&
77+
test a = "$(test-tool string-list remove_duplicates a)" &&
78+
test a = "$(test-tool string-list remove_duplicates a:a)" &&
79+
test a = "$(test-tool string-list remove_duplicates a:a:a:a:a)" &&
80+
test a:b = "$(test-tool string-list remove_duplicates a:b)" &&
81+
test a:b = "$(test-tool string-list remove_duplicates a:a:b)" &&
82+
test a:b = "$(test-tool string-list remove_duplicates a:b:b)" &&
83+
test a:b:c = "$(test-tool string-list remove_duplicates a:b:c)" &&
84+
test a:b:c = "$(test-tool string-list remove_duplicates a:a:b:c)" &&
85+
test a:b:c = "$(test-tool string-list remove_duplicates a:b:b:c)" &&
86+
test a:b:c = "$(test-tool string-list remove_duplicates a:b:c:c)" &&
87+
test a:b:c = "$(test-tool string-list remove_duplicates a:a:b:b:c:c)" &&
88+
test a:b:c = "$(test-tool string-list remove_duplicates a:a:a:b:b:b:c:c:c)"
8989
'
9090

9191
test_done

0 commit comments

Comments
 (0)