about summary refs log tree commit diff
path: root/Test
diff options
context:
space:
mode:
authorMatthew Martin <phy1729@gmail.com>2020-07-03 21:10:27 -0500
committerMatthew Martin <phy1729@gmail.com>2020-07-03 21:17:58 -0500
commit4e471c3f899b485e7a4122c75da1500c2d509236 (patch)
treec2f4237de04d7eb6ca4c10ca2057d9eb3cf8d7d7 /Test
parentb53f465481920171159d8d471f97be81d2e14fc4 (diff)
downloadzsh-4e471c3f899b485e7a4122c75da1500c2d509236.tar.gz
zsh-4e471c3f899b485e7a4122c75da1500c2d509236.tar.xz
zsh-4e471c3f899b485e7a4122c75da1500c2d509236.zip
46168: Update $PWD and call chpwd hook after normalizing path
Diffstat (limited to 'Test')
-rw-r--r--Test/B01cd.ztst19
1 files changed, 18 insertions, 1 deletions
diff --git a/Test/B01cd.ztst b/Test/B01cd.ztst
index 21e751dcb..bc6757549 100644
--- a/Test/B01cd.ztst
+++ b/Test/B01cd.ztst
@@ -33,7 +33,7 @@
 #
 # Tests should use subdirectories ending in `.tmp'.  These will be
 # removed with all the contents even if the test is aborted.
- mkdir cdtst.tmp cdtst.tmp/real cdtst.tmp/sub
+ mkdir cdtst.tmp cdtst.tmp/foo cdtst.tmp/real cdtst.tmp/sub
 
  ln -s ../real cdtst.tmp/sub/fake
 
@@ -149,6 +149,23 @@ F:something is broken.  But you already knew that.
 -f:(workers/45367) cd -P squashes multiple leading slashes
 >/dev  
 
+ chpwd_hook() { hook_pwd=$PWD; }
+ chpwd_functions=(chpwd_hook)
+ cd $mydir/cdtst.tmp/foo &&
+ (cd $mydir && mv $mydir/cdtst.tmp/{foo,bar}) &&
+ print $PWD &&
+ print $hook_pwd &&
+ cd . &&
+ print $PWD &&
+ print $hook_pwd
+ chpwd_functions=()
+ unfunction chpwd_hook
+0q:cd . with moved PWD
+>$mydir/cdtst.tmp/foo
+>$mydir/cdtst.tmp/foo
+>$mydir/cdtst.tmp/bar
+>$mydir/cdtst.tmp/bar
+
 %clean
 # This optional section cleans up after the test, if necessary,
 # e.g. killing processes etc.  This is in addition to the removal of *.tmp