test: Refactor.

This commit is contained in:
Jan Nieuwenhuizen 2018-11-03 11:29:34 +01:00
parent a0ff0853ff
commit 418652bee1
91 changed files with 93 additions and 66 deletions

View File

@ -5,59 +5,66 @@ DIFF=diff
SHELL=${SHELL-bin/gash}
tests="
assign
assign2
for
for-split-sequence
find
if2
iohere
list
ls
nesting
pipe
pipe-3
substitution
00-exit
01-exit-0
02-exit-1
03-echo
03-echo-nesting
03-echo-escaped-doublequotes
03-echo-quoted-doublequotes
04-echo-var
05-assignment-doublequoted-doublequotes
04-echo-equal
05-assignment
05-assignment-empty
05-assignment-echo
05-assignment-empty
05-assignment-singlequote
05-assignment-double-quote
05-assignment-variable-word
09-compound-word
0a-assign-substitute
0b-command-compound-word
05-assignment-word-variable
05-assignment-doublequoted-doublequotes
06-compound-word
06-command-compound-word
10-if
11-if-false
10-if-false
10-if-word-variable
11-for
11-for-split-sequence
20-semi.sh
20-pipe-exit-0
21-pipe-exit-1
22-semi-pipe-exit-0
30-assignment-substitution
30-eval
31-eval-echo-variable
32-for-substitute
33-string-args
35-assignment-eval-echo
20-pipe-exit-1
20-pipe-sed
00-sed
00-sed-once
00-sed-global
00-sed-case
00-sed-group
00-sed-group-extended
00-sed-twice
00-sed-undo
30-substitution
30-substitution-backtick
30-substitution-assignment
30-for-substitution
00-tar
00-tar-Z
00-tar-Z-old
00-tar-Z-pipe
40-eval
40-eval-echo-variable
40-assignment-eval-echo.sh
50-iohere
100-sed
100-sed-once
100-sed-global
100-sed-case
100-sed-group
100-sed-group-extended
100-sed-twice
100-sed-undo
100-sed-file
100-tar
100-tar-Z
100-tar-Z-old
100-tar-Z-pipe
"
broken="

View File

@ -0,0 +1 @@
echo foo "bar" \"baz\"

View File

@ -0,0 +1 @@
foo bar "baz"

View File

@ -0,0 +1 @@
echo foo "bar" '"baz"'

View File

@ -0,0 +1 @@
foo bar "baz"

1
test/04-echo-equal.sh Normal file
View File

@ -0,0 +1 @@
echo a=$a

View File

@ -0,0 +1 @@
a=

View File

@ -1,5 +1,4 @@
#set -x
aliaspath=alias
localedir=x
localedir=locale
defines="-DALIASPATH=\"${aliaspath}\" -DLOCALEDIR=\"${localedir}\""
echo cc $defines

View File

@ -1 +1 @@
cc -DALIASPATH="alias" -DLOCALEDIR="x"
cc -DALIASPATH="alias" -DLOCALEDIR="locale"

View File

@ -1,2 +1,2 @@
a=
echo a=$a
echo a:$a

View File

@ -1 +1 @@
a=
a:

View File

@ -1 +1,3 @@
libdir=${exec_prefix}/lib
SHELL=gash
bin=${SHELL}/bin
echo $bin

View File

@ -0,0 +1 @@
gash/bin

View File

@ -0,0 +1,3 @@
SHELL=gash
PATH=bin:${SHELL}
echo $PATH

View File

@ -0,0 +1 @@
bin:gash

View File

@ -0,0 +1,4 @@
if [ x"$y" = x ]; then
exit 0
fi
exit 1

1
test/100-sed-file.sh Normal file
View File

@ -0,0 +1 @@
\sed s,foo,bar, test/data/foo

3
test/100-sed-file.stdout Normal file
View File

@ -0,0 +1,3 @@
bar
bar
baz

3
test/11-for.stdout Normal file
View File

@ -0,0 +1,3 @@
0
1
2

View File

@ -0,0 +1,3 @@
for file in `echo foo.o bar.o`; do
echo compiling $file...
done

View File

@ -0,0 +1,2 @@
compiling foo.o...
compiling bar.o...

View File

@ -0,0 +1 @@
b=test/test

View File

@ -0,0 +1 @@
echo `echo 1 2 3`

View File

@ -0,0 +1 @@
1 2 3

1
test/30-substitution.sh Normal file
View File

@ -0,0 +1 @@
echo $(echo 1 2 3)

View File

@ -0,0 +1 @@
1 2 3

View File

@ -1,3 +0,0 @@
for file in `echo ar.o arscan.o`; do
echo compiling $file...
done

View File

@ -1,2 +0,0 @@
compiling ar.o...
compiling arscan.o...

View File

@ -1 +0,0 @@
echo foo "bar" '"baz"' \"bla\"

View File

@ -1 +0,0 @@
exec_prefix=`eval echo ${prefix}`

View File

@ -0,0 +1,3 @@
foo=bar
baz=`eval echo ${foo}`
echo $baz

View File

@ -0,0 +1 @@
bar

View File

@ -1,2 +1,3 @@
bar=SHELL
foo=baz
bar=foo
eval echo '$'$bar

View File

@ -0,0 +1 @@
baz

1
test/40-eval.stdout Normal file
View File

@ -0,0 +1 @@
0

View File

@ -1,2 +0,0 @@
ALLOCA=''

View File

@ -1,3 +0,0 @@
defines="-DALIASPATH=\"${aliaspath}\" -"
echo defines:$defines

View File

@ -1 +0,0 @@
find test -type f

View File

@ -1,3 +0,0 @@
if [ x"$y" != x ]; then
echo "boo"
fi

View File

@ -1 +0,0 @@
echo *e*a*;echo *r?p*;echo *;echo [a-l]*[m-z]*; echo;

View File

@ -1 +0,0 @@
ls *

View File

@ -1,2 +0,0 @@
echo $(find test -type f)
#echo `find test -type f`