msh: create testsuite (based on hush one)

hush: add TODO (doesn't know ":" command)
This commit is contained in:
Denis Vlasenko
2008-03-02 19:57:53 +00:00
parent 444639cc21
commit a43dba76ea
42 changed files with 318 additions and 12 deletions

View File

@ -0,0 +1 @@
hush: syntax error: unterminated "

View File

@ -0,0 +1,2 @@
# last line has no EOL!
echo "unterminated

View File

@ -0,0 +1,3 @@
TESTzzBEST
TEST$(echo zz)BEST
TEST'BEST

View File

@ -0,0 +1,3 @@
echo "TEST`echo zz;echo;echo`BEST"
echo "TEST`echo '$(echo zz)'`BEST"
echo "TEST`echo "'"`BEST"

View File

@ -0,0 +1,4 @@
read
cat
echo "REPLY=$REPLY"
REPLY=exec <read.tests

View File

@ -0,0 +1,4 @@
exec <read.tests
read
cat
echo "REPLY=$REPLY"

View File

@ -0,0 +1,6 @@
./shift.tests abc d e
./shift.tests d e 123
./shift.tests d e 123
./shift.tests
./shift.tests
./shift.tests

View File

@ -0,0 +1,14 @@
if test $# = 0; then
exec "$THIS_SH" $0 abc "d e" 123
fi
echo $0 $1 $2
shift
echo $0 $1 $2
shift 999
echo $0 $1 $2
shift 2
echo $0 $1 $2
shift 2
echo $0 $1 $2
shift
echo $0 $1 $2

View File

@ -0,0 +1,8 @@
.1 abc d e f.
.1.
.abc.
.d e f.
.-1 abc d e f-.
.-1.
.abc.
.d e f-.

View File

@ -0,0 +1,8 @@
if test $# = 0; then
exec "$THIS_SH" "$0" 1 abc 'd e f'
fi
for a in "$*"; do echo ".$a."; done
for a in "$@"; do echo ".$a."; done
for a in "-$*-"; do echo ".$a."; done
for a in "-$@-"; do echo ".$a."; done

View File

@ -0,0 +1,2 @@
shown
hush: syntax error: unterminated '

View File

@ -0,0 +1,3 @@
echo shown
echo test `echo 'aa`
echo not shown

View File

@ -0,0 +1,5 @@
. .
.abc d e.
.abc d e.
.abc d e.
.abc d e.

View File

@ -0,0 +1,15 @@
if test $# = 0; then
exec "$THIS_SH" "$0" abc "d e"
fi
space=' '
echo .$space.
a=$*
echo .$a.
a=$@
echo .$a.
a="$*"
echo .$a.
a="$@"
echo .$a.

View File

@ -0,0 +1,3 @@
TEST1
TEST2
TEST3

View File

@ -0,0 +1,13 @@
if test $# = 0; then
exec "$THIS_SH" "$0" abc "d e"
fi
echo TEST1 >"$1.out"
echo TEST2 >"$2.out"
# bash says: "$@.out": ambiguous redirect
# ash handles it as if it is '$*' - we do the same
echo TEST3 >"$@.out"
cat abc.out "d e.out" "abc d e.out"
rm abc.out "d e.out" "abc d e.out"