1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2026-01-10 11:01:32 +01:00
zsh/Test/B13whence.ztst
dana 0767fdaae3 53626: tests: make whence -s test use grep -c instead of wc -l
fixes broken test on platforms like macos where `wc -l` output is padded
2025-05-16 12:11:50 -05:00

38 lines
856 B
Text

%prep
mkdir whence.tmp
ln -s . whence.tmp/cwd
# cd through the symlink in order to test the case that ${prefix} and
# ${prefix:P} are different
pushd whence.tmp/cwd
ln -s real step3
ln -s step3 step2
ln -s step2 step1
ln -s loop loop
ln -s flip flop
ln -s flop flip
touch real
chmod +x real
prefix=$PWD
popd
%test
(
path=( ${PWD:P}/whence.tmp $path )
whence -S step1
whence -s step1
)
0q:whence symlink resolution
>${prefix:P}/step1 -> ${prefix:P}/step2 -> ${prefix:P}/step3 -> ${prefix:P}/real
>${prefix:P}/step1 -> ${prefix:P}/real
(
path=( $PWD/whence.tmp $path )
whence -S flip || whence -S loop || whence -s flip || whence -s loop
)
1:whence deals with symlink loops gracefully
whence -s =sh(:P) | grep -c '.->'
1:(workers/53524) whence -s doesn't print arrows for symlink-free paths
>0