about summary refs log tree commit diff
path: root/Test/D02glob.ztst
diff options
context:
space:
mode:
Diffstat (limited to 'Test/D02glob.ztst')
-rw-r--r--Test/D02glob.ztst38
1 files changed, 36 insertions, 2 deletions
diff --git a/Test/D02glob.ztst b/Test/D02glob.ztst
index 72891a2a7..4d88e5c27 100644
--- a/Test/D02glob.ztst
+++ b/Test/D02glob.ztst
@@ -748,13 +748,21 @@
   touch glob.tmp/secret-d$1/dir/file
   chmod $1 glob.tmp/secret-d$1
  done
- print -raC 2 -- glob.tmp/secret-*/* glob.tmp/secret-*/file
+ if (( EUID == 0 )); then
+   ZTST_skip='Not testing unreadable directories (root reads anything)'
+ else
+   print -raC 2 -- glob.tmp/secret-*/* glob.tmp/secret-*/file
+ fi
 0:names inside unreadable directories can be globbed if searchable
 >glob.tmp/secret-d444/dir   glob.tmp/secret-d444/file
 >glob.tmp/secret-s444/dir   glob.tmp/secret-s444/file
 >glob.tmp/secret-d111/file  glob.tmp/secret-s111/file
 
- print -rC 2 -- glob.tmp/secret-*/dir/*
+ if (( EUID == 0 )); then
+   ZTST_skip='Not testing unreadable directories (root reads anything)'
+ else
+   print -rC 2 -- glob.tmp/secret-*/dir/*
+ fi
 0:glob files in readable directories inside unreadable directories
 >glob.tmp/secret-d111/dir/file  glob.tmp/secret-s111/dir/file
 
@@ -809,6 +817,32 @@
 *>*/glob.tmp/(flip|flop)
 *>*/glob.tmp/(flip|flop)/trailing/components
 
+# The following set test an obscure problem with branches followed by
+# exclusions that shows up when the exclusion matches against
+# something other than the complete test string, hence the complicated
+# double negative.
+  [[ ab = (|a*)~^(*b) ]]
+0:Regression test for exclusion after branches: empty first alternative
+
+  [[ ab = (b|a*)~^(*b) ]]
+0:Regression test for exclusion after branches: non-empty first alternative
+
+  [[ ab = (b*|a*)~^(*b) ]]
+0:Regression test for exclusion after branches: full length first alternative
+
+# Corresponding tests where the exclusion should succeed, so the
+# match fails.  It's hard to know how to provoke bugs here...
+  [[ abc = (|a*)~^(*b) ]]
+1:Regression test for exclusion after branches: failure case 1
+
+  [[ abc = (b|a*)~^(*b) ]]
+1:Regression test for exclusion after branches: failure case 2
+
+  [[ abc = (b*|a*)~^(*b) ]]
+1:Regression test for exclusion after branches: failure case 3
+
+# Careful: extendedglob off from this point.
+
   unsetopt extendedglob
   print -r -- ${(*)=${(@s.+.):-A+B}/(#b)(?)/-${(L)match[1]} ${match[1]}}
 0:the '*' qualfier enables extended_glob for pattern matching