Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile2
-rw-r--r--t/helper/test-string-list.c3
-rw-r--r--t/helper/test-tool.c1
-rw-r--r--t/helper/test-tool.h1
-rwxr-xr-xt/perf/p0071-sort.sh2
-rwxr-xr-xt/t0063-string-list.sh48
6 files changed, 30 insertions, 27 deletions
diff --git a/Makefile b/Makefile
index 528a80b6a6..6819792c2b 100644
--- a/Makefile
+++ b/Makefile
@@ -681,6 +681,7 @@ TEST_BUILTINS_OBJS += test-sha1-array.o
TEST_BUILTINS_OBJS += test-sha1.o
TEST_BUILTINS_OBJS += test-sigchain.o
TEST_BUILTINS_OBJS += test-strcmp-offset.o
+TEST_BUILTINS_OBJS += test-string-list.o
TEST_PROGRAMS_NEED_X += test-dump-fsmonitor
TEST_PROGRAMS_NEED_X += test-dump-untracked-cache
@@ -688,7 +689,6 @@ TEST_PROGRAMS_NEED_X += test-fake-ssh
TEST_PROGRAMS_NEED_X += test-line-buffer
TEST_PROGRAMS_NEED_X += test-parse-options
TEST_PROGRAMS_NEED_X += test-write-cache
-TEST_PROGRAMS_NEED_X += test-string-list
TEST_PROGRAMS_NEED_X += test-submodule-config
TEST_PROGRAMS_NEED_X += test-subprocess
TEST_PROGRAMS_NEED_X += test-svn-fe
diff --git a/t/helper/test-string-list.c b/t/helper/test-string-list.c
index 829ec3d7d2..2123dda85b 100644
--- a/t/helper/test-string-list.c
+++ b/t/helper/test-string-list.c
@@ -1,3 +1,4 @@
+#include "test-tool.h"
#include "cache.h"
#include "string-list.h"
@@ -41,7 +42,7 @@ static int prefix_cb(struct string_list_item *item, void *cb_data)
return starts_with(item->string, prefix);
}
-int cmd_main(int argc, const char **argv)
+int cmd__string_list(int argc, const char **argv)
{
if (argc == 5 && !strcmp(argv[1], "split")) {
struct string_list list = STRING_LIST_INIT_DUP;
diff --git a/t/helper/test-tool.c b/t/helper/test-tool.c
index 6acbf976d8..c67307c28b 100644
--- a/t/helper/test-tool.c
+++ b/t/helper/test-tool.c
@@ -36,6 +36,7 @@ static struct test_cmd cmds[] = {
{ "sha1", cmd__sha1 },
{ "sigchain", cmd__sigchain },
{ "strcmp-offset", cmd__strcmp_offset },
+ { "string-list", cmd__string_list },
};
int cmd_main(int argc, const char **argv)
diff --git a/t/helper/test-tool.h b/t/helper/test-tool.h
index 035e82ec6a..19ad2b0df8 100644
--- a/t/helper/test-tool.h
+++ b/t/helper/test-tool.h
@@ -30,5 +30,6 @@ int cmd__sha1_array(int argc, const char **argv);
int cmd__sha1(int argc, const char **argv);
int cmd__sigchain(int argc, const char **argv);
int cmd__strcmp_offset(int argc, const char **argv);
+int cmd__string_list(int argc, const char **argv);
#endif
diff --git a/t/perf/p0071-sort.sh b/t/perf/p0071-sort.sh
index 7c9a35a646..6e924f5fa3 100755
--- a/t/perf/p0071-sort.sh
+++ b/t/perf/p0071-sort.sh
@@ -16,7 +16,7 @@ test_perf 'sort(1)' '
'
test_perf 'string_list_sort()' '
- test-string-list sort <unsorted >actual
+ test-tool string-list sort <unsorted >actual
'
test_expect_success 'string_list_sort() sorts like sort(1)' '
diff --git a/t/t0063-string-list.sh b/t/t0063-string-list.sh
index dbfc05ebdc..c6ee9f66b1 100755
--- a/t/t0063-string-list.sh
+++ b/t/t0063-string-list.sh
@@ -10,9 +10,9 @@ test_description='Test string list functionality'
test_split () {
cat >expected &&
test_expect_success "split $1 at $2, max $3" "
- test-string-list split '$1' '$2' '$3' >actual &&
+ test-tool string-list split '$1' '$2' '$3' >actual &&
test_cmp expected actual &&
- test-string-list split_in_place '$1' '$2' '$3' >actual &&
+ test-tool string-list split_in_place '$1' '$2' '$3' >actual &&
test_cmp expected actual
"
}
@@ -61,31 +61,31 @@ test_split ":" ":" "-1" <<EOF
EOF
test_expect_success "test filter_string_list" '
- test "x-" = "x$(test-string-list filter - y)" &&
- test "x-" = "x$(test-string-list filter no y)" &&
- test yes = "$(test-string-list filter yes y)" &&
- test yes = "$(test-string-list filter no:yes y)" &&
- test yes = "$(test-string-list filter yes:no y)" &&
- test y1:y2 = "$(test-string-list filter y1:y2 y)" &&
- test y2:y1 = "$(test-string-list filter y2:y1 y)" &&
- test "x-" = "x$(test-string-list filter x1:x2 y)"
+ test "x-" = "x$(test-tool string-list filter - y)" &&
+ test "x-" = "x$(test-tool string-list filter no y)" &&
+ test yes = "$(test-tool string-list filter yes y)" &&
+ test yes = "$(test-tool string-list filter no:yes y)" &&
+ test yes = "$(test-tool string-list filter yes:no y)" &&
+ test y1:y2 = "$(test-tool string-list filter y1:y2 y)" &&
+ test y2:y1 = "$(test-tool string-list filter y2:y1 y)" &&
+ test "x-" = "x$(test-tool string-list filter x1:x2 y)"
'
test_expect_success "test remove_duplicates" '
- test "x-" = "x$(test-string-list remove_duplicates -)" &&
- test "x" = "x$(test-string-list remove_duplicates "")" &&
- test a = "$(test-string-list remove_duplicates a)" &&
- test a = "$(test-string-list remove_duplicates a:a)" &&
- test a = "$(test-string-list remove_duplicates a:a:a:a:a)" &&
- test a:b = "$(test-string-list remove_duplicates a:b)" &&
- test a:b = "$(test-string-list remove_duplicates a:a:b)" &&
- test a:b = "$(test-string-list remove_duplicates a:b:b)" &&
- test a:b:c = "$(test-string-list remove_duplicates a:b:c)" &&
- test a:b:c = "$(test-string-list remove_duplicates a:a:b:c)" &&
- test a:b:c = "$(test-string-list remove_duplicates a:b:b:c)" &&
- test a:b:c = "$(test-string-list remove_duplicates a:b:c:c)" &&
- test a:b:c = "$(test-string-list remove_duplicates a:a:b:b:c:c)" &&
- test a:b:c = "$(test-string-list remove_duplicates a:a:a:b:b:b:c:c:c)"
+ test "x-" = "x$(test-tool string-list remove_duplicates -)" &&
+ test "x" = "x$(test-tool string-list remove_duplicates "")" &&
+ test a = "$(test-tool string-list remove_duplicates a)" &&
+ test a = "$(test-tool string-list remove_duplicates a:a)" &&
+ test a = "$(test-tool string-list remove_duplicates a:a:a:a:a)" &&
+ test a:b = "$(test-tool string-list remove_duplicates a:b)" &&
+ test a:b = "$(test-tool string-list remove_duplicates a:a:b)" &&
+ test a:b = "$(test-tool string-list remove_duplicates a:b:b)" &&
+ test a:b:c = "$(test-tool string-list remove_duplicates a:b:c)" &&
+ test a:b:c = "$(test-tool string-list remove_duplicates a:a:b:c)" &&
+ test a:b:c = "$(test-tool string-list remove_duplicates a:b:b:c)" &&
+ test a:b:c = "$(test-tool string-list remove_duplicates a:b:c:c)" &&
+ test a:b:c = "$(test-tool string-list remove_duplicates a:a:b:b:c:c)" &&
+ test a:b:c = "$(test-tool string-list remove_duplicates a:a:a:b:b:b:c:c:c)"
'
test_done