[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] add wildcard tests
From: |
Dmitry Goncharov |
Subject: |
[PATCH] add wildcard tests |
Date: |
Sat, 16 Dec 2017 23:54:31 -0500 |
User-agent: |
Mutt/1.5.21 (2010-09-15) |
These are wildcard tests that pass patterns with trailing slash.
These tests verify the glob patch sent in a separate email.
regards, Dmitry
diff --git a/tests/run_make_tests.pl b/tests/run_make_tests.pl
index cd8a643..99d56bc 100644
--- a/tests/run_make_tests.pl
+++ b/tests/run_make_tests.pl
@@ -47,7 +47,7 @@ $all_tests = 0;
$sh_name = '/bin/sh';
$is_posix_sh = 1;
-$CMD_rmfile = 'rm -f';
+$CMD_rmfile = 'rm -rf';
# rmdir broken in some Perls on VMS.
if ($^O eq 'VMS')
diff --git a/tests/scripts/functions/wildcard b/tests/scripts/functions/wildcard
index f91d9ad..d1c0400 100644
--- a/tests/scripts/functions/wildcard
+++ b/tests/scripts/functions/wildcard
@@ -18,14 +18,30 @@ open(MAKEFILE,"> $makefile");
# The Contents of the MAKEFILE ...
print MAKEFILE <<EOM;
-.PHONY: print1 print2 clean
+.PHONY: print1 print2 print3 clean
print1: ;address@hidden \$(sort \$(wildcard example.*))
print2:
address@hidden \$(sort \$(wildcard example.?))
address@hidden \$(sort \$(wildcard example.[a-z0-9]))
address@hidden \$(sort \$(wildcard example.[!A-Za-z_\\!]))
+print3:
address@hidden \$(sort \$(wildcard hello*))
address@hidden \$(sort \$(wildcard hello*/))
address@hidden \$(sort \$(wildcard hellod/world*))
address@hidden \$(sort \$(wildcard hellod/world*/))
address@hidden \$(sort \$(wildcard hello* hellod/world*))
address@hidden \$(sort \$(wildcard hello*/ hellod/world*/))
address@hidden \$(sort \$(wildcard /))
address@hidden \$(sort \$(wildcard hellod/*))
address@hidden \$(sort \$(wildcard hellod/*/))
address@hidden \$(sort \$(wildcard */world*))
address@hidden \$(sort \$(wildcard */worldd/))
address@hidden \$(sort \$(wildcard hellod/*/ken*/))
address@hidden \$(sort \$(wildcard hellod/*/ken?[12]))
address@hidden \$(sort \$(wildcard hellod/*/ken?[12]/))
+
clean:
-\t$CMD_rmfile \$(sort \$(wildcard example.*))
+\t$CMD_rmfile \$(sort \$(wildcard example.* hellof hellod))
EOM
# END of Contents of MAKEFILE
@@ -37,6 +53,14 @@ close(MAKEFILE);
&touch("example.3");
&touch("example.for");
&touch("example._");
+&touch("hellof");
+mkdir("hellod", 0770);
+mkdir("hellod/worldd", 0770);
+&touch("hellod/worldf");
+mkdir("hellod/worldd/kend1", 0770);
+mkdir("hellod/worldd/kend2", 0770);
+&touch("hellod/worldd/kenf1");
+&touch("hellod/worldd/kenf2");
# TEST #1
# -------
@@ -59,11 +83,34 @@ $answer = "example.1 example.3 example._\n"
&compare_output($answer,&get_logfile(1));
+# TEST #3: verify that when the input pattern has a trailing slash wildcard
+# returns only directories.
+# -------
+
+$answer = "hellod hellof\n"
+ ."hellod/\n"
+ ."hellod/worldd hellod/worldf\n"
+ ."hellod/worldd/\n"
+ ."hellod hellod/worldd hellod/worldf hellof\n"
+ ."hellod/ hellod/worldd/\n"
+ ."/\n"
+ ."hellod/worldd hellod/worldf\n"
+ ."hellod/worldd/\n"
+ ."hellod/worldd hellod/worldf\n"
+ ."hellod/worldd/\n"
+ ."hellod/worldd/kend1/ hellod/worldd/kend2/\n"
+ ."hellod/worldd/kend1 hellod/worldd/kend2 "
+ ."hellod/worldd/kenf1 hellod/worldd/kenf2\n"
+ ."hellod/worldd/kend1/ hellod/worldd/kend2/\n";
+
+&run_make_with_options($makefile,"print3",&get_logfile);
+&compare_output($answer,&get_logfile(1));
-# TEST #3
+# TEST #4
# -------
-$answer = "$CMD_rmfile example.1 example.3 example._ example.for example.two";
+$answer = "$CMD_rmfile example.1 example.3 example._ example.for example.two"
+ ." hellod hellof";
if ($vos)
{
$answer .= " \n";
@@ -81,14 +128,14 @@ if ((-f "example.1")||(-f "example.two")||(-f
"example.3")||(-f "example.for"))
&compare_output($answer,&get_logfile(1));
-# TEST #4: Verify that failed wildcards don't return the pattern
+# TEST #5: Verify that failed wildcards don't return the pattern
run_make_test(q!
all: ; @echo $(wildcard xz--y*.7)
!,
'', "\n");
-# TEST #5: wildcard used to verify file existence
+# TEST #6: wildcard used to verify file existence
touch('xxx.yyy');
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [PATCH] add wildcard tests,
Dmitry Goncharov <=