diff options
Diffstat (limited to 'Test')
-rw-r--r-- | Test/D02glob.ztst | 28 | ||||
-rw-r--r-- | Test/D04parameter.ztst | 77 | ||||
-rw-r--r-- | Test/W01history.ztst | 23 |
3 files changed, 128 insertions, 0 deletions
diff --git a/Test/D02glob.ztst b/Test/D02glob.ztst index 08b71dc8e..5638e1255 100644 --- a/Test/D02glob.ztst +++ b/Test/D02glob.ztst @@ -700,3 +700,31 @@ print ${value//[${foo}b-z]/x} 0:handling of - range in complicated pattern context >xx + + pathtotest=glob.tmp/my/test/dir/that/does/not/exist + mkdir -p $pathtotest + print $pathtotest(:h) + print $pathtotest(:h0) + print $pathtotest(:h10) + print $pathtotest(:h3) + print $pathtotest(:h2) + print $pathtotest(:h1) + print $pathtotest(:t) + print $pathtotest(:t0) + print $pathtotest(:t10) + print $pathtotest(:t3) + print $pathtotest(:t2) + print $pathtotest(:t1) +0:modifiers :h and :t with numbers (main test is in D04parameter.ztst) +>glob.tmp/my/test/dir/that/does/not +>glob.tmp/my/test/dir/that/does/not +>glob.tmp/my/test/dir/that/does/not/exist +>glob.tmp/my/test +>glob.tmp/my +>glob.tmp +>exist +>exist +>glob.tmp/my/test/dir/that/does/not/exist +>does/not/exist +>not/exist +>exist diff --git a/Test/D04parameter.ztst b/Test/D04parameter.ztst index 1ec650352..194c3e287 100644 --- a/Test/D04parameter.ztst +++ b/Test/D04parameter.ztst @@ -2445,3 +2445,80 @@ F:behavior, see http://austingroupbugs.net/view.php?id=888 : <<< ${(F)x/y} } 0:Separation / join logic regresssion test + + testpath=/one/two/three/four + for (( i = 0; i <= 6; ++i )); do + eval "print \$testpath:t$i" + eval "print \${testpath:t$i}" + done +0:t with trailing digits +>four0 +>four +>four1 +>four +>four2 +>three/four +>four3 +>two/three/four +>four4 +>one/two/three/four +>four5 +>/one/two/three/four +>four6 +>/one/two/three/four + + testpath=/one/two/three/four + for (( i = 0; i <= 6; ++i )); do + eval "print \$testpath:h$i" + eval "print \${testpath:h$i}" + done +0:h with trailing digits +>/one/two/three0 +>/one/two/three +>/one/two/three1 +>/ +>/one/two/three2 +>/one +>/one/two/three3 +>/one/two +>/one/two/three4 +>/one/two/three +>/one/two/three5 +>/one/two/three/four +>/one/two/three6 +>/one/two/three/four + + testpath=/a/quite/long/path/to/do/messy/stuff/with + print $testpath:h2:t3:h5:t16:h2n2 + print ${testpath:t5:h2} + print ${testpath:t5:h2:t} + print ${testpath:h6:t4:h3:t2:h} + print ${testpath:h10:t10:t6:h3} + print ${testpath:t9:h} + print ${testpath:t9:h:t} +0:Combinations of :h and :t with and without trailing digits +>/a/quite/long/path/to/do/messy/stuff2:t3:h5:t16:h2n2 +>to/do +>do +>long +>path/to/do +>a/quite/long/path/to/do/messy/stuff +>stuff + + testpath=///this//has////lots//and////lots//of////slashes + print ${testpath:h3} + print ${testpath:t4} +0:Multiple slashes are treated as one in :h and :t but are not removed +>///this//has +>and////lots//of////slashes + + testpath=trailing/slashes/are/removed/// + print ${testpath:h} + print ${testpath:h2} + print ${testpath:t} + print ${testpath:t2} +0:Modifiers :h and :t remove trailing slashes before examining path +>trailing/slashes/are +>trailing/slashes +>removed +>are/removed diff --git a/Test/W01history.ztst b/Test/W01history.ztst index 6ef9b11cc..96d0beb61 100644 --- a/Test/W01history.ztst +++ b/Test/W01history.ztst @@ -58,3 +58,26 @@ *?* F:Check that a history bug introduced by workers/34160 is working again. # Discarded line of error output consumes prompts printed by "zsh -i". + + $ZTST_testdir/../Src/zsh -fis <<<' + echo /my/path/for/testing + echo !1:1:h10 + echo !1:1:h3 + echo !1:1:h2 + echo !1:1:h1 + echo !1:1:t10 + echo !1:1:t3 + echo !1:1:t2 + echo !1:1:t1 + echo !1:1:t3:h2' 2>/dev/null +0:Modifiers :h and :t with arguments +>/my/path/for/testing +>/my/path/for/testing +>/my/path +>/my +>/ +>/my/path/for/testing +>path/for/testing +>for/testing +>testing +>path/for |