aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/arith-for.right2
-rw-r--r--tests/arith-for.tests7
-rw-r--r--tests/arith.right6
-rw-r--r--tests/arith.tests8
-rw-r--r--tests/array.right25
-rw-r--r--tests/array.tests18
-rw-r--r--tests/cond.right4
-rwxr-xr-xtests/cond.tests13
-rw-r--r--tests/cprint.right4
-rwxr-xr-xtests/dollar-at-star91
-rw-r--r--tests/dollar.right24
-rw-r--r--tests/exec.right16
-rw-r--r--tests/exec6.sub54
-rw-r--r--tests/execscript7
-rw-r--r--tests/func.right30
-rw-r--r--tests/func.tests7
-rw-r--r--tests/func2.sub17
-rw-r--r--tests/func3.sub54
-rw-r--r--tests/glob-test5
-rw-r--r--tests/glob.right1
-rw-r--r--tests/more-exp.right6
-rw-r--r--tests/more-exp.tests17
-rw-r--r--tests/new-exp.right6
-rw-r--r--tests/new-exp.tests26
-rw-r--r--tests/posix2.tests10
-rw-r--r--tests/set-e-test15
-rw-r--r--tests/set-e.right2
-rw-r--r--tests/shopt.right9
-rw-r--r--tests/test.right12
-rw-r--r--tests/test.tests14
-rw-r--r--tests/trap.right1
-rw-r--r--tests/trap.tests9
-rw-r--r--tests/varenv.right10
-rw-r--r--tests/varenv.sh4
-rw-r--r--tests/varenv1.sub28
35 files changed, 539 insertions, 23 deletions
diff --git a/tests/arith-for.right b/tests/arith-for.right
index f5b43e0..0c05d98 100644
--- a/tests/arith-for.right
+++ b/tests/arith-for.right
@@ -70,3 +70,5 @@ fx ()
./arith-for.tests: line 83: syntax error: `;' unexpected
./arith-for.tests: line 83: syntax error: `(( i=0; i < 3; i++; 7 ))'
2
+20
+20
diff --git a/tests/arith-for.tests b/tests/arith-for.tests
index 1d6da80..585aa51 100644
--- a/tests/arith-for.tests
+++ b/tests/arith-for.tests
@@ -85,3 +85,10 @@ do
echo $i
done
echo $?
+
+# one-liners added in post-bash-2.04
+for ((i=0; i < 20; i++)) do : ; done
+echo $i
+
+for ((i=0; i < 20; i++)) { : ; }
+echo $i
diff --git a/tests/arith.right b/tests/arith.right
index d70ad78..5933620 100644
--- a/tests/arith.right
+++ b/tests/arith.right
@@ -144,3 +144,9 @@ ok
./arith.tests: ((: x=9 y=41 : syntax error in expression (error token is "y=41 ")
./arith.tests: a b: syntax error in expression (error token is "b")
./arith.tests: ((: a b: syntax error in expression (error token is "b")
+42
+42
+42
+42
+42
+42
diff --git a/tests/arith.tests b/tests/arith.tests
index 913efbe..fa56ad7 100644
--- a/tests/arith.tests
+++ b/tests/arith.tests
@@ -267,3 +267,11 @@ echo $x $y
# These are errors
echo $((a b))
((a b))
+
+n=42
+printf "%d\n" $n
+printf "%i\n" $n
+echo $(( 8#$(printf "%o\n" $n) ))
+printf "%u\n" $n
+echo $(( 16#$(printf "%x\n" $n) ))
+echo $(( 16#$(printf "%X\n" $n) ))
diff --git a/tests/array.right b/tests/array.right
index 2d3c179..80027b2 100644
--- a/tests/array.right
+++ b/tests/array.right
@@ -110,11 +110,20 @@ for case if then else
<> < > !
12 14 16 18 20
4414758999202
-./array.tests: array assign: line 257: syntax error near unexpected token `for'
-./array.tests: array assign: line 257: `a b c for case if then else'
-./array.tests: array assign: line 259: syntax error near unexpected token `for'
-./array.tests: array assign: line 259: `for case if then else'
-./array.tests: array assign: line 261: syntax error near unexpected token `<>'
-./array.tests: array assign: line 261: ` <> < > ! '
-./array.tests: array assign: line 262: syntax error near unexpected token `[1]=<>'
-./array.tests: array assign: line 262: ` [1]=<> [2]=< [3]=> [4]=! '
+aaa bbb
+./array.tests: array assign: line 262: syntax error near unexpected token `for'
+./array.tests: array assign: line 262: `a b c for case if then else'
+./array.tests: array assign: line 264: syntax error near unexpected token `for'
+./array.tests: array assign: line 264: `for case if then else'
+./array.tests: array assign: line 266: syntax error near unexpected token `<>'
+./array.tests: array assign: line 266: ` <> < > ! '
+./array.tests: array assign: line 267: syntax error near unexpected token `[1]=<>'
+./array.tests: array assign: line 267: ` [1]=<> [2]=< [3]=> [4]=! '
+abc 3
+0
+abc 1
+abc 1
+0
+0
+1
+1
diff --git a/tests/array.tests b/tests/array.tests
index 6f23486..d8b6564 100644
--- a/tests/array.tests
+++ b/tests/array.tests
@@ -253,6 +253,11 @@ echo ${foo[@]}
foo=( 4414758999202 )
echo ${foo[@]}
+# this was a bug in all versions of bash 2.x up to and including bash-2.04
+declare -a ddd=(aaa
+bbb)
+echo ${ddd[@]}
+
# errors
foo=(a b c for case if then else)
@@ -260,3 +265,16 @@ foo=(for case if then else)
metas=( <> < > ! )
metas=( [1]=<> [2]=< [3]=> [4]=! )
+
+# various expansions that didn't really work right until post-bash-2.04
+foo='abc'
+echo ${foo[0]} ${#foo[0]}
+echo ${foo[1]} ${#foo[1]}
+echo ${foo[@]} ${#foo[@]}
+echo ${foo[*]} ${#foo[*]}
+
+foo=''
+echo ${foo[0]} ${#foo[0]}
+echo ${foo[1]} ${#foo[1]}
+echo ${foo[@]} ${#foo[@]}
+echo ${foo[*]} ${#foo[*]}
diff --git a/tests/cond.right b/tests/cond.right
index 4e2a07a..a14ed9e 100644
--- a/tests/cond.right
+++ b/tests/cond.right
@@ -2,6 +2,10 @@ returns: 0
returns: 0
returns: 1
returns: 0
+returns: 0
+returns: 0
+returns: 0
+returns: 0
returns: 1
returns: 0
returns: 0
diff --git a/tests/cond.tests b/tests/cond.tests
index 4f3cbdf..acaa527 100755
--- a/tests/cond.tests
+++ b/tests/cond.tests
@@ -20,6 +20,19 @@ echo returns: $?
[[ ! x || x ]]
echo returns: $?
+# parenthesized terms didn't work right until post-2.04
+[[ a ]]
+echo returns: $?
+
+[[ (a) ]]
+echo returns: $?
+
+[[ -n a ]]
+echo returns: $?
+
+[[ (-n a) ]]
+echo returns: $?
+
# unset variables don't need to be quoted
[[ -n $UNSET ]]
echo returns: $?
diff --git a/tests/cprint.right b/tests/cprint.right
index d8d4d28..6b711b8 100644
--- a/tests/cprint.right
+++ b/tests/cprint.right
@@ -55,8 +55,8 @@ tf2 ()
{
( {
time -p echo a | cat - >/dev/null
- } )
-} 2>&1
+ } ) 2>&1
+}
cprint.tests is a regular file
cprint.tests is not a directory
a
diff --git a/tests/dollar-at-star b/tests/dollar-at-star
index 307bf31..1a754d8 100755
--- a/tests/dollar-at-star
+++ b/tests/dollar-at-star
@@ -117,3 +117,94 @@ unset IFS
recho "$@"
recho $@
recho "$*"
+
+IFS=:
+
+# special variables
+set -- 1 2 3 4 5 6 7 8 9 10
+
+bar=${*}
+foo=$*
+echo foo = "$foo"
+echo bar = "$bar"
+
+foo1=$@
+bar1=${@}
+
+echo foo1 = "$foo1"
+echo bar1 = "$bar1"
+
+foo2="$*"
+bar2="${*}"
+
+echo foo2 = "$foo2"
+echo bar2 = "$bar2"
+
+eval foo3='$*' bar3='${*}'
+echo foo3 = "$foo3"
+echo bar3 = "$bar3"
+
+case $* in
+*\:*) echo ok 1;;
+*) echo bad 1;;
+esac
+
+case $@ in
+*\:*) echo bad 2;;
+*) echo ok 2;;
+esac
+
+case "$*" in
+*\:*) echo ok 3;;
+*) echo bad 3;;
+esac
+
+case "$@" in
+*\:*) echo bad 4;;
+*) echo ok 4;;
+esac
+
+IFS=$' \t\n'
+
+bar=${*}
+foo=$*
+echo foo = "$foo"
+echo bar = "$bar"
+
+foo1=$@
+bar1=${@}
+
+echo foo1 = "$foo1"
+echo bar1 = "$bar1"
+
+foo2="$*"
+bar2="${*}"
+
+echo foo2 = "$foo2"
+echo bar2 = "$bar2"
+
+eval foo3='$*' bar3='${*}'
+echo foo3 = "$foo3"
+echo bar3 = "$bar3"
+
+case $* in
+*\ *) echo ok 1;;
+*) echo bad 1;;
+esac
+
+case $@ in
+*\ *) echo ok 2;;
+*) echo bad 2;;
+esac
+
+case "$*" in
+*\ *) echo ok 3;;
+*) echo bad 3;;
+esac
+
+case "$@" in
+*\ *) echo ok 4;;
+*) echo bad 4;;
+esac
+
+exit 0
diff --git a/tests/dollar.right b/tests/dollar.right
index d7cb914..345775b 100644
--- a/tests/dollar.right
+++ b/tests/dollar.right
@@ -71,3 +71,27 @@ argv[1] = <foo>
argv[2] = <bar>
argv[3] = <bam>
argv[1] = <foo bar bam>
+foo = 1:2:3:4:5:6:7:8:9:10
+bar = 1:2:3:4:5:6:7:8:9:10
+foo1 = 1 2 3 4 5 6 7 8 9 10
+bar1 = 1 2 3 4 5 6 7 8 9 10
+foo2 = 1:2:3:4:5:6:7:8:9:10
+bar2 = 1:2:3:4:5:6:7:8:9:10
+foo3 = 1:2:3:4:5:6:7:8:9:10
+bar3 = 1:2:3:4:5:6:7:8:9:10
+ok 1
+ok 2
+ok 3
+ok 4
+foo = 1 2 3 4 5 6 7 8 9 10
+bar = 1 2 3 4 5 6 7 8 9 10
+foo1 = 1 2 3 4 5 6 7 8 9 10
+bar1 = 1 2 3 4 5 6 7 8 9 10
+foo2 = 1 2 3 4 5 6 7 8 9 10
+bar2 = 1 2 3 4 5 6 7 8 9 10
+foo3 = 1 2 3 4 5 6 7 8 9 10
+bar3 = 1 2 3 4 5 6 7 8 9 10
+ok 1
+ok 2
+ok 3
+ok 4
diff --git a/tests/exec.right b/tests/exec.right
index bd447c3..556f1a1 100644
--- a/tests/exec.right
+++ b/tests/exec.right
@@ -16,7 +16,7 @@ notthere: notthere: No such file or directory
126
./execscript: .: /: is a directory
1
-126
+127
./execscript: .: /dev/null: not a regular file
1
this is bashenv
@@ -37,3 +37,17 @@ ok
./exec5.sub: exec: bash-notthere: not found
127
this is ohio-state
+0
+1
+1
+0
+42
+42
+0
+1
+1
+0
+0
+1
+0
+1
diff --git a/tests/exec6.sub b/tests/exec6.sub
new file mode 100644
index 0000000..50d0e70
--- /dev/null
+++ b/tests/exec6.sub
@@ -0,0 +1,54 @@
+# builtins with exit status inverted
+
+( true )
+echo $?
+( ! true )
+echo $?
+
+( false )
+echo $?
+( ! false )
+echo $?
+
+# inverting shouldn't affect exit
+(exit 42)
+echo $?
+
+( ! exit 42 )
+echo $?
+
+# commands requiring an exec with exit status inverted -- broken in bash-2.04
+
+( ls > /dev/null 2>&1 )
+echo $?
+( ! ls > /dev/null 2>&1 )
+echo $?
+
+touch /tmp/notwrite
+chmod 400 /tmp/notwrite
+
+# make sure redirection failures in commands whose exit status is inverted
+# are handled correctly
+
+( ls > /tmp/notwrite ) 2>/dev/null
+echo $?
+
+( ! ls > /tmp/notwrite ) 2>/dev/null
+echo $?
+
+# now add exit traps, true and false for commands with and without exit
+# status inversion
+
+(trap 'false' 0 ; ! ls > /tmp/notwrite ) 2>/dev/null
+echo $?
+
+(trap 'false' 0 ; ls > /tmp/notwrite ) 2>/dev/null
+echo $?
+
+(trap 'true' 0 ; ! ls > /tmp/notwrite ) 2>/dev/null
+echo $?
+
+(trap 'true' 0 ; ls > /tmp/notwrite ) 2>/dev/null
+echo $?
+
+rm -f /tmp/notwrite
diff --git a/tests/execscript b/tests/execscript
index ed38c8e..749b733 100644
--- a/tests/execscript
+++ b/tests/execscript
@@ -35,6 +35,8 @@ echo $?
. /
echo $?
+# try sourcing a binary file -- post-2.04 versions don't do the binary file
+# check, and will probably fail with `command not found', or status 127
. ${THIS_SH} 2>/dev/null
echo $?
@@ -82,3 +84,8 @@ ${THIS_SH} ./exec5.sub
# this was a bug in bash versions before bash-2.04
${THIS_SH} -c 'cat </dev/null | cat >/dev/null' >&-
+
+# checks for proper return values in subshell commands with inverted return
+# values
+
+${THIS_SH} ./exec6.sub
diff --git a/tests/func.right b/tests/func.right
index 3980395..e51d92b 100644
--- a/tests/func.right
+++ b/tests/func.right
@@ -118,3 +118,33 @@ testgrp ()
} 1>&2;
echo testgrp-b
}
+funca is a function
+funca ()
+{
+ ( echo func-a )
+}
+funcb is a function
+funcb ()
+{
+ ( echo func-b )
+}
+funcc is a function
+funcc ()
+{
+ ( echo func-c ) 2>&1
+}
+func-a
+func-b
+func-c
+expect 5 10
+5 10
+expect 20
+20
+expect 5 20
+5 20
+expect 5 30
+5 30
+expect 2 40
+2 40
+expect 5 20
+5 20
diff --git a/tests/func.tests b/tests/func.tests
index ed3d355..2095f24 100644
--- a/tests/func.tests
+++ b/tests/func.tests
@@ -150,4 +150,11 @@ ${THIS_SH} -c 'type zf'
${THIS_SH} ./func1.sub
+# tests for functions whose bodies are not group commands, with and without
+# attached redirections
+${THIS_SH} ./func2.sub
+
+# test for some posix-specific function behavior
+${THIS_SH} ./func3.sub
+
exit 0
diff --git a/tests/func2.sub b/tests/func2.sub
new file mode 100644
index 0000000..2f9d5ce
--- /dev/null
+++ b/tests/func2.sub
@@ -0,0 +1,17 @@
+funca() (
+ echo func-a
+)
+
+funcb() ( echo func-b )
+
+funcc() (
+ echo func-c
+) 2>&1
+
+type funca
+type funcb
+type funcc
+
+funca
+funcb
+funcc
diff --git a/tests/func3.sub b/tests/func3.sub
new file mode 100644
index 0000000..9d3d069
--- /dev/null
+++ b/tests/func3.sub
@@ -0,0 +1,54 @@
+#
+# test some posix-mode-specific function behavior
+#
+set -o posix
+func()
+{
+ return 5
+}
+
+myfunction () {
+ var=20 return
+}
+var=10
+echo expect 5 10
+func
+echo $? $var
+
+myfunction
+echo expect 20
+echo $var
+
+echo expect 5 20
+func
+echo $? $var
+
+echo expect 5 30
+var=30 func
+echo $? $var
+
+: ${TMPDIR:=/tmp}
+TMPFILE=$TMPDIR/func3.sub.$$
+
+rm -f $TMPFILE
+echo 'var=40 return 2' > $TMPFILE
+
+# test the behavior of `return' and preceding variable assignments here
+# because it's convenient
+var=10
+echo expect 2 40
+. $TMPFILE
+echo $? $var
+
+rm -f $TMPFILE
+
+#set -o posix
+var=0
+func()
+{
+ var=20 return 5
+}
+
+echo expect 5 20
+var=30 func
+echo $? $var
diff --git a/tests/glob-test b/tests/glob-test
index 88ffe0c..f2c4d33 100644
--- a/tests/glob-test
+++ b/tests/glob-test
@@ -296,6 +296,11 @@ case p in
[a-\z]) echo ok 36 ;;
esac
+# this was a bug in all versions up to bash-2.04-release
+case "/tmp" in
+[/\\]*) echo ok 37 ;;
+esac
+
# none of these should output anything
case abc in
diff --git a/tests/glob.right b/tests/glob.right
index c9bdbfe..08f1778 100644
--- a/tests/glob.right
+++ b/tests/glob.right
@@ -94,6 +94,7 @@ ok 33
ok 34
ok 35
ok 36
+ok 37
argv[1] = <b>
argv[2] = <bb>
argv[3] = <bcd>
diff --git a/tests/more-exp.right b/tests/more-exp.right
index c7e1af5..194fdeb 100644
--- a/tests/more-exp.right
+++ b/tests/more-exp.right
@@ -206,3 +206,9 @@ argv[1] = <xxx>
argv[2] = <yyy>
1
argv[1] = <>
+argv[1] = <>
+argv[1] = <>
+argv[1] = <:a:>
+argv[1] = <:b:>
+argv[1] = <>
+argv[1] = <>
diff --git a/tests/more-exp.tests b/tests/more-exp.tests
index a562ae8..a2b7f77 100644
--- a/tests/more-exp.tests
+++ b/tests/more-exp.tests
@@ -481,4 +481,21 @@ set -- ''
expect 1
echo $#
expect '<>'
+recho "${@}"
+expect '<>'
+recho "${@-}"
+expect '<>'
+recho "${@:-}"
+
+# this was a bug in bash-2.04, fixed in 2.05
+set -- a b
+expect '<:a:>' '<:b:>'
+for i in "${@-}"; do recho :$i:; done
+
+# I believe that ksh93 does these wrong -- we're using the rhs, so shouldn't
+# it behave the same as ""?
+set --
+expect '<>'
+recho "${@-}"
+expect '<>'
recho "${@:-}"
diff --git a/tests/new-exp.right b/tests/new-exp.right
index c2dc10b..db66ab0 100644
--- a/tests/new-exp.right
+++ b/tests/new-exp.right
@@ -48,6 +48,12 @@ argv[2] = <ef>
argv[3] = <gh ij>
argv[4] = <kl mn>
argv[5] = <op>
+argv[1] = </home/chet/foo//bar/abcabcabc>
+argv[1] = <home/chet/foo//bar/abcabcabc>
+argv[1] = <home>
+argv[1] = <home>
+argv[1] = <home>
+argv[1] = <home>
argv[1] = <abcdefghijklmnop>
argv[1] = <4>
argv[1] = <op>
diff --git a/tests/new-exp.tests b/tests/new-exp.tests
index 683fa46..4a33c35 100644
--- a/tests/new-exp.tests
+++ b/tests/new-exp.tests
@@ -118,6 +118,32 @@ recho "${@:3:4}"
expect '<ab cd> <ef> <gh ij> <kl mn> <op>'
recho "${@:1:$#}"
+# code to ad-hoc parse arithmetic expressions in substring expansions was
+# broken until post-2.04
+base=/home/chet/foo//bar
+string1=$base/abcabcabc
+x=1 j=4
+
+expect '</home/chet/foo//bar/abcabcabc>'
+recho ${string1:0}
+
+expect '<home/chet/foo//bar/abcabcabc>'
+recho ${string1:1}
+
+expect '<home>'
+recho ${string1:(j?1:0):j}
+
+expect '<home>'
+recho ${string1:j?1:0:j}
+
+expect '<home>'
+recho ${string1:(j?(x?1:0):0):j}
+
+expect '<home>'
+recho ${string1:j?(x?1:0):0:j}
+
+unset base string1 x j
+
# indirect variable references
expect '<abcdefghijklmnop>'
recho ${!9:-$z}
diff --git a/tests/posix2.tests b/tests/posix2.tests
index e6d2479..2161379 100644
--- a/tests/posix2.tests
+++ b/tests/posix2.tests
@@ -140,18 +140,20 @@ if [ "$OPTIND" != 3 ] || [ "$store" != a ] || [ "$OPTARG" != aoptval ]; then
testfail "getopts"
fi
+# if I change the default quoting style for variable values, these
+# next four must change
+
newtest
SQUOTE="'"
val1=$(set | sed -n 's:^SQUOTE=::p')
-# if I change the default quoting style for variable values, this must change
-if [ "$val1" != "''\'''" ]; then
+if [ "$val1" != "\$'\\''" ]; then
testfail "variable quoting 1"
fi
newtest
VTILDE='~'
val1=$(set | sed -n 's:^VTILDE=::p')
-if [ "$val1" != "'~'" ]; then
+if [ "$val1" != "\$'~'" ]; then
testfail "variable quoting 2"
fi
@@ -165,7 +167,7 @@ fi
newtest
VHASH2=#abcd
val1=$(set | sed -n 's:^VHASH2=::p')
-if [ "$val1" != "'#abcd'" ]; then
+if [ "$val1" != "\$'#abcd'" ]; then
testfail "variable quoting 4"
fi
diff --git a/tests/set-e-test b/tests/set-e-test
index 895aff7..fe1549c 100644
--- a/tests/set-e-test
+++ b/tests/set-e-test
@@ -14,6 +14,21 @@ if : ; then
done
set +e
fi
+
+(
+set -e
+false
+echo bad
+)
+echo $?
+
+x=$(
+set -e
+false
+echo bad
+)
+echo $? $x
+
# command subst should not inherit -e
set -e
echo $(false; echo ok)
diff --git a/tests/set-e.right b/tests/set-e.right
index aa98063..6448413 100644
--- a/tests/set-e.right
+++ b/tests/set-e.right
@@ -13,6 +13,8 @@
7
8
9
+1
+1
ok
hi
while succeeded
diff --git a/tests/shopt.right b/tests/shopt.right
index 3eff4b5..32c422a 100644
--- a/tests/shopt.right
+++ b/tests/shopt.right
@@ -98,7 +98,7 @@ set +o verbose
set +o xtrace
set -o history
set +o ignoreeof
-set +o interactive-comments
+set -o interactive-comments
set +o posix
set -o emacs
set +o vi
@@ -122,7 +122,7 @@ verbose off
xtrace off
history on
ignoreeof off
-interactive-comments off
+interactive-comments on
posix off
emacs on
vi off
@@ -146,7 +146,7 @@ set +o verbose
set +o xtrace
set -o history
set +o ignoreeof
-set +o interactive-comments
+set -o interactive-comments
set +o posix
set -o emacs
set +o vi
@@ -160,6 +160,7 @@ set -o histexpand
set -o monitor
set -o privileged
set -o history
+set -o interactive-comments
set -o emacs
--
set +o allexport
@@ -175,7 +176,6 @@ set +o physical
set +o verbose
set +o xtrace
set +o ignoreeof
-set +o interactive-comments
set +o posix
set +o vi
--
@@ -192,7 +192,6 @@ physical off
verbose off
xtrace off
ignoreeof off
-interactive-comments off
posix off
vi off
--
diff --git a/tests/test.right b/tests/test.right
index 2fd4680..854e5dc 100644
--- a/tests/test.right
+++ b/tests/test.right
@@ -270,3 +270,15 @@ b ( 1 = 2
2
./test.tests: test: (: unary operator expected
2
+t -t a
+1
+t -t addsds
+1
+t -t 42
+1
+t -t /dev/tty
+1
+t -t /dev/tty4
+1
+t -t /dev/tty4444444...
+1
diff --git a/tests/test.tests b/tests/test.tests
index 9df5cc2..d84af1b 100644
--- a/tests/test.tests
+++ b/tests/test.tests
@@ -407,3 +407,17 @@ t 4 -eq 4 -a 3 4
echo $?
t \( \)
+
+# non-numeric arguments to `test -t' should return failure -- fix in 2.05
+echo 't -t a'
+t -t a
+echo 't -t addsds'
+t -t addsds
+echo 't -t 42'
+t -t 42
+echo 't -t /dev/tty'
+t -t /dev/tty
+echo 't -t /dev/tty4'
+t -t /dev/tty4
+echo 't -t /dev/tty4444444...'
+t -t /dev/tty4444444...
diff --git a/tests/trap.right b/tests/trap.right
index 6fa6ba5..f7b89a5 100644
--- a/tests/trap.right
+++ b/tests/trap.right
@@ -44,6 +44,7 @@ trap -- '' SIGINT
trap -- 'echo aborting' SIGQUIT
trap -- 'echo aborting' SIGABRT
trap -- 'echo aborting' SIGTERM
+0
caught a child death
caught a child death
caught a child death
diff --git a/tests/trap.tests b/tests/trap.tests
index bcf16e5..24f25ab 100644
--- a/tests/trap.tests
+++ b/tests/trap.tests
@@ -40,6 +40,15 @@ trap '' int
trap
+# exit 0 in exit trap should set exit status
+(
+set -e
+trap 'exit 0' EXIT
+false
+echo bad
+)
+echo $?
+
# hmmm...should this set the handling to SIG_IGN for children, too?
trap '' USR2
./trap1.sub
diff --git a/tests/varenv.right b/tests/varenv.right
index f5baaae..d477ceb 100644
--- a/tests/varenv.right
+++ b/tests/varenv.right
@@ -29,8 +29,12 @@ declare -i ivar="10"
unset
declare -x ivar="42"
hB
-braceexpand:hashall
+braceexpand:hashall:interactive-comments
hPB
-braceexpand:hashall:physical
-declare -r SHELLOPTS="braceexpand:hashall:physical"
+braceexpand:hashall:physical:interactive-comments
+declare -r SHELLOPTS="braceexpand:hashall:physical:interactive-comments"
abcde
+20
+30
+40
+50
diff --git a/tests/varenv.sh b/tests/varenv.sh
index 4f90761..0cac0fd 100644
--- a/tests/varenv.sh
+++ b/tests/varenv.sh
@@ -194,3 +194,7 @@ set -a
typeset FOOFOO=abcde
printenv FOOFOO
+
+# test out export behavior of variable assignments preceding builtins and
+# functions
+$THIS_SH ./varenv1.sub
diff --git a/tests/varenv1.sub b/tests/varenv1.sub
new file mode 100644
index 0000000..168f87b
--- /dev/null
+++ b/tests/varenv1.sub
@@ -0,0 +1,28 @@
+# test out the export behavior of variable assignments preceding `eval', `.'
+# and shell functions
+
+func()
+{
+ printenv var
+}
+
+export var=10
+echo expect 20
+var=20 eval printenv var
+
+: ${TMPDIR:=/tmp}
+TMPFILE=$TMPDIR/evalsub.$$
+
+rm -f $TMPFILE
+echo 'printenv var' > $TMPFILE
+
+echo expect 30
+var=30 . $TMPFILE
+
+rm -f $TMPFILE
+
+echo expect 40
+var=40 func
+
+echo expect 50
+var=50 command printenv var