fix cd symlink resolution tests on Cygwin

This commit is contained in:
David Adam
2026-05-30 00:00:42 +08:00
parent 611a1a0bdf
commit af09b60aeb

View File

@@ -55,19 +55,21 @@ else
end
# CHECKERR: pwd: realpath failed: {{.+}}
mkdir $real/subdir
cd $link
test "$PWD" = "$link" || echo "Default cd should keep symlink:"\n "\$PWD: $PWD"\n "\$link: $link"\n
cd -P $link
test "$PWD" = "$real" || echo "cd -P should resolve symlink:"\n "\$PWD: $PWD"\n "\$real: $real"\n
cd $link/subdir
test "$PWD" = "$link/subdir" || echo "Logical cd should keep subdir symlink:"\n "\$PWD: $PWD"\n "\$link/subdir: $link/subdir"\n
cd -P ..
test "$PWD" = "$real" || echo "cd -P .. should use physical parent:"\n "\$PWD: $PWD"\n "\$real: $real"\n
cd $link/subdir
cd -L ..
test "$PWD" = "$link" || echo "cd -L .. should use logical parent:"\n "\$PWD: $PWD"\n "\$link: $link"\n
cd $base
if not set -q nosymlinks
mkdir $real/subdir
cd $link
test "$PWD" = "$link" || echo "Default cd should keep symlink:"\n "\$PWD: $PWD"\n "\$link: $link"\n
cd -P $link
test "$PWD" = "$real" || echo "cd -P should resolve symlink:"\n "\$PWD: $PWD"\n "\$real: $real"\n
cd $link/subdir
test "$PWD" = "$link/subdir" || echo "Logical cd should keep subdir symlink:"\n "\$PWD: $PWD"\n "\$link/subdir: $link/subdir"\n
cd -P ..
test "$PWD" = "$real" || echo "cd -P .. should use physical parent:"\n "\$PWD: $PWD"\n "\$real: $real"\n
cd $link/subdir
cd -L ..
test "$PWD" = "$link" || echo "cd -L .. should use logical parent:"\n "\$PWD: $PWD"\n "\$link: $link"\n
cd $base
end
# Create a symlink and verify logical completion.
# create directory $base/through/the/looking/glass