mksh/tests/unclass2.t
tg a34b05d2e6 Import OpenBSD 3.3 source repository from CTM 3132 the first time
This opens an OpenBSD-mirabile (aka MirBSD) repository.

### MirBSD is:
# Copyright (c) 1982-2003 by Thorsten "mirabile" Glaser <x86@ePost.de>
# Copyright © 1968-2003  The authors of And contributors to UNIX®, the
#       C Language, BSD/Berkeley Unix; 386BSD, NetBSD 1.1 and OpenBSD.
#
# Anyone who obtained a copy of this work is hereby permitted to freely use,
# distribute, modify, merge, sublicence, give away or sell it as long as the
# authors are given due credit and the following notice is retained:
#
# This work is provided "as is", with no explicit or implicit warranty what-
# soever. Use it only at your own risk. In no event may an author or contri-
# butor be held liable for any damage, directly or indirectly, that origina-
# ted through or is caused by creation or modification of this work.

MirBSD is my private tree. MirBSD does not differ very much from OpenBSD
and intentionally tracks OpenBSD. That's why it _is_ OpenBSD, just not the
official one. It's like with DarrenBSD.

At time of this writing, no advertising for MirBSD must be done,
because the advertising clause has not yet been sorted out.

http://templeofhate.com/tglaser/MirBSD/index.php
2003-03-22 17:35:03 +00:00

164 lines
2.3 KiB
Perl

name: xxx-subsitution-eval-order
description:
Check order of evaluation of expressions
stdin:
i=1 x= y=
set -A A abc def GHI j G k
echo ${A[x=(i+=1)]#${A[y=(i+=2)]}}
echo $x $y
expected-stdout:
HI
2 4
---
name: xxx-set-option-1
description:
Check option parsing in set
stdin:
set -vsA foo -- A 1 3 2
echo ${foo[*]}
expected-stderr:
echo ${foo[*]}
expected-stdout:
1 2 3 A
---
name: xxx-exec-1
description:
Check that exec exits for built-ins
arguments: !-i!
stdin:
exec print hi
echo still herre
expected-stdout:
hi
expected-stderr-pattern: /.*/
---
name: xxx-while-1
description:
Check the return value of while loops
XXX need to do same for for/select/until loops
stdin:
i=x
while [ $i != xxx ] ; do
i=x$i
if [ $i = xxx ] ; then
false
continue
fi
done
echo loop1=$?
i=x
while [ $i != xxx ] ; do
i=x$i
if [ $i = xxx ] ; then
false
break
fi
done
echo loop2=$?
i=x
while [ $i != xxx ] ; do
i=x$i
false
done
echo loop3=$?
expected-stdout:
loop1=0
loop2=0
loop3=1
---
name: xxx-status-1
description:
Check that blank lines don't clear $?
arguments: !-i!
stdin:
(exit 1)
echo $?
(exit 1)
echo $?
true
expected-stdout:
1
1
expected-stderr-pattern: /.*/
---
name: xxx-status-2
description:
Check that $? is preserved in subshells, includes, traps.
stdin:
(exit 1)
echo blank: $?
(exit 2)
(echo subshell: $?)
echo 'echo include: $?' > foo
(exit 3)
. ./foo
trap 'echo trap: $?' ERR
(exit 4)
echo exit: $?
expected-stdout:
blank: 1
subshell: 2
include: 3
trap: 4
exit: 4
---
name: xxx-clean-chars-1
description:
Check MAGIC character is stuffed correctly
stdin:
echo `echo [£`
expected-stdout:
---
name: xxx-param-subst-qmark-1
description:
Check suppresion of error message with null string. According to
POSIX, it shouldn't print the error as `word' isn't ommitted.
stdin:
unset foo
x=
echo x${foo?$x}
expected-exit: 1
expected-fail: yes
expected-stderr-pattern: !/not set/
---
name: xxx-param-_-1
description:
Check c flag is set.
arguments: !-c!echo "[$-]"!
expected-stdout-pattern: /^\[.*c.*\]$/
---
name: env-prompt
description:
Check that prompt not printed when processing ENV
env-setup: !ENV=./foo!
file-setup: file 644 "foo"
XXX=_
PS1=X
false && echo hmmm
arguments: !-i!
stdin:
echo hi${XXX}there
expected-stdout:
hi_there
expected-stderr: !
XX
---