]> git.ipfire.org Git - thirdparty/bash.git/blame - tests/dstack.tests
Imported from ../bash-4.0-rc1.tar.gz.
[thirdparty/bash.git] / tests / dstack.tests
CommitLineData
cce855bc
JA
1export LC_ALL=C
2export LANG=C
3
d166f048 4dirs -c
cce855bc
JA
5# error -- nonexistant directory
6pushd /tmp/xxx-notthere
7
d166f048
JA
8# errors -- empty stack
9pushd
10popd
11
12# errors -- bad numeric arguments -- should not cause the script to exit
13pushd -m
14popd -m
15dirs -m
cce855bc 16dirs 7
d166f048
JA
17
18MYDIR=$PWD
19unalias cd 2>/dev/null
20
21unalias -a
22
23command cd -P /
cce855bc 24command pwd -P # better be `/'
d166f048
JA
25
26case "$OLDPWD" in
27$MYDIR) echo ok ;;
28*) echo oops -- bad \$OLDPWD ;;
29esac
30
31pushd /usr
32echo $PWD $OLDPWD
33dirs
34echo ${DIRSTACK[@]}
35
36# this should not change the directory stack at all
37pushd -n +0
38dirs
39
40popd
41pushd /usr
42
43pushd /etc
44dirs
45dirs -l
46dirs -v
47
48# two consecutive `pushd's should swap the top two stack elements, then
49# swap them back, leaving the stack intact
50pushd
51pushd
52
53pushd /tmp
54echo ${DIRSTACK[0]} ; dirs +0
55echo ${DIRSTACK[2]} ; dirs +2
56
57# these should be errors, but not affect the directory stack
58dirs +9; dirs -9
59pushd +9 ; pushd -9
60popd +9 ; popd -9
61
62popd -n +2
63dirs
64echo ${DIRSTACK[@]}
65
66pushd -n /usr
67echo $PWD
68dirs
69echo ${DIRSTACK[@]}
70
71builtin pwd
72
73DIRSTACK[1]=/bin
74dirs
75
76builtin pwd
77popd +2
78builtin pwd -L
79pushd -1
80dirs
81echo ${DIRSTACK[0]}
82
83dirs -c
84dirs
85
86# this is for the benefit of pure coverage
3185942a 87cd "$MYDIR"