t/helper: merge test-wildmatch 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:45 UTC
0489289de2d70d86ccb20cf5870bd697fd7cf1a2
5 files changed
+12
-9
Makefile
+1
-1
@@ -685,6 +685,7 @@ TEST_BUILTINS_OBJS += test-string-list.o
685
TEST_BUILTINS_OBJS += test-submodule-config.o
686
TEST_BUILTINS_OBJS += test-subprocess.o
687
TEST_BUILTINS_OBJS += test-urlmatch-normalization.o
688
+TEST_BUILTINS_OBJS += test-wildmatch.o
689
690
TEST_PROGRAMS_NEED_X += test-dump-fsmonitor
691
TEST_PROGRAMS_NEED_X += test-dump-untracked-cache
@@ -694,7 +695,6 @@ TEST_PROGRAMS_NEED_X += test-parse-options
695
TEST_PROGRAMS_NEED_X += test-write-cache
696
TEST_PROGRAMS_NEED_X += test-svn-fe
697
TEST_PROGRAMS_NEED_X += test-tool
697
-TEST_PROGRAMS_NEED_X += test-wildmatch
698
699
TEST_PROGRAMS = $(patsubst %,t/helper/%$X,$(TEST_PROGRAMS_NEED_X))
700
t/helper/test-tool.c
+1
@@ -40,6 +40,7 @@ static struct test_cmd cmds[] = {
40
{ "submodule-config", cmd__submodule_config },
41
{ "subprocess", cmd__subprocess },
42
{ "urlmatch-normalization", cmd__urlmatch_normalization },
43
+ { "wildmatch", cmd__wildmatch },
44
};
45
46
int cmd_main(int argc, const char **argv)
t/helper/test-tool.h
+1
@@ -34,5 +34,6 @@ int cmd__string_list(int argc, const char **argv);
34
int cmd__submodule_config(int argc, const char **argv);
35
int cmd__subprocess(int argc, const char **argv);
36
int cmd__urlmatch_normalization(int argc, const char **argv);
37
+int cmd__wildmatch(int argc, const char **argv);
38
39
#endif
t/helper/test-wildmatch.c
+2
-1
@@ -1,6 +1,7 @@
1
+#include "test-tool.h"
2
#include "cache.h"
3
3
-int cmd_main(int argc, const char **argv)
4
+int cmd__wildmatch(int argc, const char **argv)
5
{
6
int i;
7
for (i = 2; i < argc; i++) {
t/t3070-wildmatch.sh
+7
-7
@@ -79,12 +79,12 @@ match_with_function() {
79
if test "$match_expect" = 1
80
then
81
test_expect_success "$match_function: match '$text' '$pattern'" "
82
- test-wildmatch $match_function '$text' '$pattern'
82
+ test-tool wildmatch $match_function '$text' '$pattern'
83
"
84
elif test "$match_expect" = 0
85
then
86
test_expect_success "$match_function: no match '$text' '$pattern'" "
87
- test_must_fail test-wildmatch $match_function '$text' '$pattern'
87
+ test_must_fail test-tool wildmatch $match_function '$text' '$pattern'
88
"
89
else
90
test_expect_success "PANIC: Test framework error. Unknown matches value $match_expect" 'false'
@@ -148,7 +148,7 @@ match_with_ls_files() {
148
match() {
149
if test "$#" = 6
150
then
151
- # When test-wildmatch and git ls-files produce the same
151
+ # When test-tool wildmatch and git ls-files produce the same
152
# result.
153
match_glob=$1
154
match_file_glob=$match_glob
@@ -204,19 +204,19 @@ match() {
204
fi
205
'
206
207
- # $1: Case sensitive glob match: test-wildmatch & ls-files
207
+ # $1: Case sensitive glob match: test-tool wildmatch & ls-files
208
match_with_function "$text" "$pattern" $match_glob "wildmatch"
209
match_with_ls_files "$text" "$pattern" $match_file_glob "wildmatch" " --glob-pathspecs"
210
211
- # $2: Case insensitive glob match: test-wildmatch & ls-files
211
+ # $2: Case insensitive glob match: test-tool wildmatch & ls-files
212
match_with_function "$text" "$pattern" $match_iglob "iwildmatch"
213
match_with_ls_files "$text" "$pattern" $match_file_iglob "iwildmatch" " --glob-pathspecs --icase-pathspecs"
214
215
- # $3: Case sensitive path match: test-wildmatch & ls-files
215
+ # $3: Case sensitive path match: test-tool wildmatch & ls-files
216
match_with_function "$text" "$pattern" $match_pathmatch "pathmatch"
217
match_with_ls_files "$text" "$pattern" $match_file_pathmatch "pathmatch" ""
218
219
- # $4: Case insensitive path match: test-wildmatch & ls-files
219
+ # $4: Case insensitive path match: test-tool wildmatch & ls-files
220
match_with_function "$text" "$pattern" $match_pathmatchi "ipathmatch"
221
match_with_ls_files "$text" "$pattern" $match_file_pathmatchi "ipathmatch" " --icase-pathspecs"
222
}