diff --git a/check.sh b/check.sh index 6a1679a..59071fb 100755 --- a/check.sh +++ b/check.sh @@ -16,6 +16,7 @@ list ls nesting pipe +pipe-3 substitution 00-exit 01-exit-0 @@ -24,10 +25,11 @@ substitution 04-echo-var 05-assignment-doublequoted-doublequotes 05-assignment -06-assignment-echo -06-assignment-singlequote -07-assignment-double-quote -08-assignment-variable-word +05-assignment-empty +05-assignment-echo +05-assignment-singlequote +05-assignment-double-quote +05-assignment-variable-word 09-compound-word 0a-assign-substitute 0b-command-compound-word diff --git a/gash/script.scm b/gash/script.scm index fbd5bc9..44a951c 100644 --- a/gash/script.scm +++ b/gash/script.scm @@ -77,7 +77,7 @@ (command (cons program (cdr command)))) (or (builtin command #:prefer-builtin? (or %prefer-builtins? escape-builtin?)) - (cut apply (compose status:exit-val system*) command)))) + (lambda _ (status:exit-val (apply system* command)))))) (else (lambda () #t)))) (exec (append-map glob args))) @@ -118,9 +118,7 @@ (string-join (append-map glob o) "")) (define (sequence . args) - (format (current-error-port) "sequence args=~s\n" args) (let ((glob (append-map glob (apply append args)))) - (format (current-error-port) " => sequence glob=~s\n" glob) glob)) (define (run ast) diff --git a/test.sh b/test.sh index babfbe9..3a0f097 100755 --- a/test.sh +++ b/test.sh @@ -8,7 +8,7 @@ SHELL=${SHELL-bin/gash} t=$1 b=test/$(basename $t .sh) set +e -$SHELL -e $b.sh > $b.1 2> $b.2 +timeout 1 $SHELL -e $b.sh > $b.1 2> $b.2 r=$? set -e if [ -f $b.exit ]; then diff --git a/test/07-assignment-double-quote.sh b/test/05-assignment-double-quote.sh similarity index 100% rename from test/07-assignment-double-quote.sh rename to test/05-assignment-double-quote.sh diff --git a/test/05-assignment-doublequoted-doublequotes.stdout b/test/05-assignment-doublequoted-doublequotes.stdout new file mode 100644 index 0000000..5380254 --- /dev/null +++ b/test/05-assignment-doublequoted-doublequotes.stdout @@ -0,0 +1 @@ +cc -DALIASPATH="alias" -DLOCALEDIR="x" diff --git a/test/06-assignment-echo.sh b/test/05-assignment-echo.sh similarity index 100% rename from test/06-assignment-echo.sh rename to test/05-assignment-echo.sh diff --git a/test/05-assignment-empty.sh b/test/05-assignment-empty.sh new file mode 100644 index 0000000..6aba02a --- /dev/null +++ b/test/05-assignment-empty.sh @@ -0,0 +1,2 @@ +a= +echo a=$a diff --git a/test/05-assignment-empty.stdout b/test/05-assignment-empty.stdout new file mode 100644 index 0000000..2afe6dc --- /dev/null +++ b/test/05-assignment-empty.stdout @@ -0,0 +1 @@ +a= diff --git a/test/06-assignment-singlequote.sh b/test/05-assignment-singlequote.sh similarity index 100% rename from test/06-assignment-singlequote.sh rename to test/05-assignment-singlequote.sh diff --git a/test/08-assignment-variable-word.sh b/test/05-assignment-variable-word.sh similarity index 100% rename from test/08-assignment-variable-word.sh rename to test/05-assignment-variable-word.sh diff --git a/test/09-compound-word.stdout b/test/09-compound-word.stdout new file mode 100644 index 0000000..81f5a26 --- /dev/null +++ b/test/09-compound-word.stdout @@ -0,0 +1 @@ +cc -c ./ diff --git a/test/0a-assign-substitute.sh b/test/0a-assign-substitute.sh index 91b1091..51c6bf6 100644 --- a/test/0a-assign-substitute.sh +++ b/test/0a-assign-substitute.sh @@ -1,2 +1,3 @@ obj=ar.o objs="$objs `basename $obj`" +echo "objs:>$objs<" diff --git a/test/0a-assign-substitute.stdout b/test/0a-assign-substitute.stdout new file mode 100644 index 0000000..2cde7c4 --- /dev/null +++ b/test/0a-assign-substitute.stdout @@ -0,0 +1 @@ +objs:> ar.o< diff --git a/test/0b-command-compound-word.stdout b/test/0b-command-compound-word.stdout new file mode 100644 index 0000000..366e732 --- /dev/null +++ b/test/0b-command-compound-word.stdout @@ -0,0 +1 @@ +-I ar.o diff --git a/test/32-for-substitute.stdout b/test/32-for-substitute.stdout new file mode 100644 index 0000000..ec37551 --- /dev/null +++ b/test/32-for-substitute.stdout @@ -0,0 +1,2 @@ +compiling ar.o... +compiling arscan.o... diff --git a/test/data/star/0 b/test/data/star/0 new file mode 100644 index 0000000..e69de29 diff --git a/test/data/star/1 b/test/data/star/1 new file mode 100644 index 0000000..e69de29 diff --git a/test/data/star/2 b/test/data/star/2 new file mode 100644 index 0000000..e69de29 diff --git a/test/data/star/3 b/test/data/star/3 new file mode 100644 index 0000000..e69de29 diff --git a/test/for-split-sequence.sh b/test/for-split-sequence.sh index 4716fe7..1ef55e4 100644 --- a/test/for-split-sequence.sh +++ b/test/for-split-sequence.sh @@ -1,5 +1,4 @@ one=1 -two_n_halve= -for i in 0 $one 2 $two_n_halve 3 ""; do +for i in 0 $one 2 $two_n_halve $two_n_quaaar and 3 ""; do echo $i; done diff --git a/test/for-split-sequence.stdout b/test/for-split-sequence.stdout new file mode 100644 index 0000000..b1fc8b4 --- /dev/null +++ b/test/for-split-sequence.stdout @@ -0,0 +1,6 @@ +0 +1 +2 +and +3 + diff --git a/test/iohere.stdout b/test/iohere.stdout new file mode 100644 index 0000000..323fae0 --- /dev/null +++ b/test/iohere.stdout @@ -0,0 +1 @@ +foobar diff --git a/test/nesting.stdout b/test/nesting.stdout new file mode 100644 index 0000000..5635c74 --- /dev/null +++ b/test/nesting.stdout @@ -0,0 +1 @@ +foo "bar" diff --git a/test/pipe-3.sh b/test/pipe-3.sh new file mode 100644 index 0000000..0c1fb4a --- /dev/null +++ b/test/pipe-3.sh @@ -0,0 +1 @@ +echo -e 'a\nb\nc' test/data/star/* | sed 's, ,\n,g' | cat diff --git a/test/pipe-3.stdout b/test/pipe-3.stdout new file mode 100644 index 0000000..36c2abd --- /dev/null +++ b/test/pipe-3.stdout @@ -0,0 +1,7 @@ +a +b +c +test/data/star/0 +test/data/star/1 +test/data/star/2 +test/data/star/3 diff --git a/test/pipe.sh b/test/pipe.sh index 9055090..5fb2d9e 100644 --- a/test/pipe.sh +++ b/test/pipe.sh @@ -1 +1 @@ -echo -e 'a\nb\nc' * | sed 's, ,\n,g' | cat +echo -e 'a\nb\nc' test/data/star/* | \sed 's, ,\n,g' diff --git a/test/pipe.stdout b/test/pipe.stdout new file mode 100644 index 0000000..36c2abd --- /dev/null +++ b/test/pipe.stdout @@ -0,0 +1,7 @@ +a +b +c +test/data/star/0 +test/data/star/1 +test/data/star/2 +test/data/star/3