Add a few very basic tests for cd -{L,P} and pwd -{L,P}.
This commit is contained in:
parent
10efa8a238
commit
a85bade2b1
@ -1,17 +1,27 @@
|
||||
# $FreeBSD$
|
||||
set -e
|
||||
|
||||
PDIR=${TMPDIR:-/tmp}
|
||||
cd ${PDIR}
|
||||
TMPDIR=$(mktemp -d sh-test.XXXXXX)
|
||||
chmod 0 ${TMPDIR}
|
||||
P=${TMPDIR:-/tmp}
|
||||
cd $P
|
||||
T=$(mktemp -d sh-test.XXXXXX)
|
||||
|
||||
cd -L ${TMPDIR} 2>/dev/null && exit 1
|
||||
[ "${PWD}" = "${PDIR}" ]
|
||||
[ "$(pwd)" = "${PDIR}" ]
|
||||
cd -P ${TMPDIR} 2>/dev/null && exit 1
|
||||
[ "${PWD}" = "${PDIR}" ]
|
||||
[ "$(pwd)" = "${PDIR}" ]
|
||||
chmod 0 $T
|
||||
cd -L $T 2>/dev/null && exit 1
|
||||
[ "$PWD" = "$P" ]
|
||||
[ "$(pwd)" = "$P" ]
|
||||
cd -P $T 2>/dev/null && exit 1
|
||||
[ "$PWD" = "$P" ]
|
||||
[ "$(pwd)" = "$P" ]
|
||||
|
||||
chmod 755 ${TMPDIR}
|
||||
rmdir ${TMPDIR}
|
||||
chmod 755 $T
|
||||
cd $T
|
||||
mkdir -p 1/2/3
|
||||
ln -s 1/2 link1
|
||||
ln -s 2/3 1/link2
|
||||
(cd -L 1/../1 && [ "$(pwd -L)" = "$P/$T/1" ])
|
||||
(cd -L link1 && [ "$(pwd -L)" = "$P/$T/link1" ])
|
||||
(cd -L link1 && [ "$(pwd -P)" = "$P/$T/1/2" ])
|
||||
(cd -P link1 && [ "$(pwd -L)" = "$P/$T/1/2" ])
|
||||
(cd -P link1 && [ "$(pwd -P)" = "$P/$T/1/2" ])
|
||||
|
||||
rm -rf ${P}/${T}
|
||||
|
Loading…
x
Reference in New Issue
Block a user