summary refs log tree commit diff
path: root/Test
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2008-09-26 09:11:27 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2008-09-26 09:11:27 +0000
commitb2d08a2155afe05d2dd6a01b6a2d2c5035d30b45 (patch)
treed5da7bfce0adcab7703f8997ad34c1a59996c3de /Test
parent84584ea58bf0a8f58ed0dcd30d769adffa3377f7 (diff)
downloadzsh-b2d08a2155afe05d2dd6a01b6a2d2c5035d30b45.tar.gz
zsh-b2d08a2155afe05d2dd6a01b6a2d2c5035d30b45.tar.xz
zsh-b2d08a2155afe05d2dd6a01b6a2d2c5035d30b45.zip
25744: dynamic named directories and further doshfunc() simplification
Diffstat (limited to 'Test')
-rw-r--r--Test/D01prompt.ztst43
1 files changed, 43 insertions, 0 deletions
diff --git a/Test/D01prompt.ztst b/Test/D01prompt.ztst
index 361847aa1..84f9c7cbe 100644
--- a/Test/D01prompt.ztst
+++ b/Test/D01prompt.ztst
@@ -1,5 +1,7 @@
 %prep
 
+  mkdir prompt.tmp
+  cd prompt.tmp
   mydir=$PWD
   SHLVL=2
   setopt extendedglob
@@ -104,3 +106,44 @@
     print "Years do not agree in $date2, $date3"
   fi
 0:Dates produced by prompt escapes
+
+  mkdir foo
+  mkdir foo/bar
+  mkdir foo/bar/rod
+  (zsh_directory_name() {
+    emulate -L zsh
+    setopt extendedglob
+    local -a match mbegin mend
+    if [[ $1 = d ]]; then
+      if [[ $2 = (#b)(*bar)/rod ]]; then
+        reply=(barmy ${#match[1]})
+      else
+        return 1
+      fi
+    else
+      if [[ $2 = barmy ]]; then
+        reply=($mydir/foo/bar)
+      else
+        return 1
+      fi
+    fi
+  }
+  # success
+  print ~[barmy]/anything
+  cd foo/bar/rod
+  print -P %~
+  # failure
+  setopt nonomatch
+  print ~[scuzzy]/rubbish
+  cd ../..
+  print -P %~
+  # catastrophic failure
+  unsetopt nonomatch
+  print ~[scuzzy]/rubbish
+  )
+1q:Dynamic named directories
+>$mydir/foo/bar/anything
+>~[barmy]/rod
+>~[scuzzy]/rubbish
+>~mydir/foo
+?(eval):33: no directory expansion: ~[scuzzy]