diff --git a/.gitignore b/.gitignore index b12a926..b085392 100644 --- a/.gitignore +++ b/.gitignore @@ -22,8 +22,7 @@ /lcov.info /pre-inst-env /scripts/gash -/tests/*.1 -/tests/*.2 +/tests/run-test-suite /tests/spec/oil /tests/spec/oil-link /tests/unit/config.scm diff --git a/Makefile.am b/Makefile.am index b292fa6..7d31074 100644 --- a/Makefile.am +++ b/Makefile.am @@ -28,7 +28,7 @@ EXTRA_DIST += \ build-aux/gitlab-ci.yml \ build-aux/gitlog-to-changelog \ guix.scm \ - tests/README + tests/data/README # Modules and scripts ##################### @@ -103,10 +103,11 @@ EXTRA_DIST += \ # Tests ####### -TEST_EXTENSIONS = .scm .sh +TEST_EXTENSIONS = .scm .org SCM_LOG_COMPILER = $(top_builddir)/pre-inst-env $(GUILE) AM_SCM_LOG_FLAGS = --no-auto-compile -SH_LOG_COMPILER = $(top_builddir)/pre-inst-env $(top_srcdir)/test.sh +ORG_LOG_COMPILER = $(top_builddir)/pre-inst-env \ + $(top_builddir)/tests/run-test-suite .PHONY: check-spec check-spec: @@ -128,234 +129,47 @@ UNIT_TESTS = \ tests/unit/word.scm FULL_TESTS = \ - tests/00-exit.sh \ - tests/00-exit-0.sh \ - tests/00-exit-1.sh \ - tests/00-exit-2.sh \ - tests/00-exit-error.sh \ - tests/00-exit-var.sh \ - tests/01-script-newline.sh \ - tests/01-script-semi.sh \ - tests/01-script-backslash.sh \ - tests/01-script-backslash-space.sh \ - tests/01-script-backslash-twice.sh \ - tests/01-script-arg-0.sh \ - tests/01-script-arg-length.sh \ - tests/01-script-arg-list.sh \ - tests/01-script-shift.sh \ - tests/03-echo.sh \ - tests/03-echo-doublequotes.sh \ - tests/03-echo-nesting.sh \ - tests/03-echo-escaped-doublequotes.sh \ - tests/03-echo-quoted-doublequotes.sh \ - tests/03-echo-brace.sh \ - tests/04-echo-var.sh \ - tests/04-echo-equal.sh \ - tests/04-echo-word-at.sh \ - tests/04-echo-word-at-word.sh \ - tests/05-assignment.sh \ - tests/05-assignment-backtick.sh \ - tests/05-assignment-echo.sh \ - tests/05-assignment-empty.sh \ - tests/05-assignment-singlequote.sh \ - tests/05-assignment-double-quote.sh \ - tests/05-assignment-variable-word.sh \ - tests/05-assignment-word-variable.sh \ - tests/05-assignment-doublequoted-doublequotes.sh \ - tests/06-compound-word.sh \ - tests/06-command-compound-word.sh \ - tests/07-variable-or.sh \ - tests/07-variable-not-or.sh \ - tests/07-variable-or-slash.sh \ - tests/07-variable-or-variable.sh \ - tests/07-variable-or-doublequote.sh \ - tests/07-variable-or-empty.sh \ - tests/08-variable-and.sh \ - tests/08-variable-not-and.sh \ - tests/10-if.sh \ - tests/10-if-false.sh \ - tests/10-if-word-variable.sh \ - tests/10-if-line.sh \ - tests/10-if-multiple.sh \ - tests/10-if-else.sh \ - tests/10-else-multiple.sh \ - tests/10-if-elif.sh \ - tests/10-if-redirect.sh \ - tests/10-if-test.sh \ - tests/10-if-test-false.sh \ - tests/10-if-bracket.sh \ - tests/10-if-bracket-false.sh \ - tests/11-for.sh \ - tests/11-for-split-sequence.sh \ - tests/11-for-done-subshell.sh \ - tests/20-semi.sh \ - tests/20-or.sh \ - tests/20-and.sh \ - tests/20-pipe-exit-0.sh \ - tests/20-pipe-exit-1.sh \ - tests/20-pipe-sed.sh \ - tests/20-pipe-sed-cat.sh \ - tests/20-exec.sh \ - tests/30-substitution.sh \ - tests/30-substitution-word.sh \ - tests/30-substitution-backtick.sh \ - tests/30-substitution-assignment.sh \ - tests/30-for-substitution.sh \ - tests/30-substitution-assignment.sh \ - tests/30-substitution-assignment-at.sh \ - tests/30-substitution-redirect.sh \ - tests/40-eval.sh \ - tests/40-eval-echo-variable.sh \ - tests/40-assignment-eval-echo.sh \ - tests/41-dot.sh \ - tests/42-sh.sh \ - tests/42-sh-export.sh \ - tests/42-export-new.sh \ - tests/42-sh-export-new.sh \ - tests/43-trap-subshell.sh \ - tests/50-iohere.sh \ - tests/50-iohere-builtin.sh \ - tests/50-redirect.sh \ - tests/50-redirect-in.sh \ - tests/50-redirect-append.sh \ - tests/50-redirect-pipe.sh \ - tests/50-redirect-sed.sh \ - tests/50-redirect-space.sh \ - tests/50-redirect-in-out.sh \ - tests/50-redirect-clobber.sh \ - tests/60-function.sh \ - tests/60-function-at.sh \ - tests/60-subst.sh \ - tests/70-hash.sh \ - tests/70-hash-hash.sh \ - tests/70-percent.sh \ - tests/70-percent-percent.sh \ - tests/70-percent-space.sh \ - tests/70-slash.sh \ - tests/70-slash-string.sh \ - tests/70-slash-string-slash.sh \ - tests/100-cd.sh \ - tests/100-cd-foo.sh \ - tests/100-test.sh \ - tests/100-test-false.sh \ - tests/100-test-file.sh \ - tests/100-bracket-file.sh + tests/arguments.org \ + tests/assignments.org \ + tests/command-substitution.org \ + tests/compound-words.org \ + tests/conditionals.org \ + tests/dot.org \ + tests/eval.org \ + tests/exiting.org \ + tests/exporting.org \ + tests/functions.org \ + tests/loops.org \ + tests/pipes-and-booleans.org \ + tests/redirects.org \ + tests/signals.org \ + tests/variable-and.org \ + tests/variable-or.org \ + tests/variable-patterns.org \ + tests/variable-words.org \ + tests/words.org TESTS = $(UNIT_TESTS) $(FULL_TESTS) XFAIL_TESTS = \ - tests/70-hash.sh \ - tests/70-hash-hash.sh \ - tests/70-percent.sh \ - tests/70-percent-percent.sh \ - tests/70-percent-space.sh \ - tests/70-slash.sh \ - tests/70-slash-string.sh \ - tests/70-slash-string-slash.sh - -# These tests will not be run. Put tests here -# that pass or fail based on environmental -# factors. -BROKEN_TESTS = \ - tests/50-redirect-merge.sh + tests/variable-patterns.org TEST_DATA_FILES = \ - tests/00-exit-1.exit \ - tests/00-exit-2.exit \ - tests/00-exit-error.exit \ - tests/00-exit-var.exit \ - tests/01-script-arg-length.stdout \ - tests/01-script-arg-list.stdout \ - tests/01-script-backslash-twice.exit \ - tests/01-script-backslash.exit \ - tests/01-script-newline.exit \ - tests/01-script-semi.exit \ - tests/01-script-shift.stdout \ - tests/03-echo-brace.stdout \ - tests/03-echo-doublequotes.stdout \ - tests/03-echo-escaped-doublequotes.stdout \ - tests/03-echo-nesting.stdout \ - tests/03-echo-quoted-doublequotes.stdout \ - tests/04-echo-equal.stdout \ - tests/04-echo-word-at-word.stdout \ - tests/04-echo-word-at.stdout \ - tests/05-assignment-backtick.stdout \ - tests/05-assignment-doublequoted-doublequotes.stdout \ - tests/05-assignment-echo.stdout \ - tests/05-assignment-empty.stdout \ - tests/05-assignment-variable-word.stdout \ - tests/05-assignment-word-variable.stdout \ - tests/06-command-compound-word.stdout \ - tests/06-compound-word.stdout \ - tests/07-variable-not-or.stdout \ - tests/07-variable-or-doublequote.stdout \ - tests/07-variable-or-empty.stdout \ - tests/07-variable-or-variable.stdout \ - tests/07-variable-or.stdout \ - tests/08-variable-and.stdout \ - tests/08-variable-not-and.stdout \ - tests/10-else.multiple.stdout \ - tests/10-if-multiple.stdout \ - tests/11-for-done-subshell.stdout \ - tests/11-for-split-sequence.stdout \ - tests/11-for.stdout \ - tests/20-and.exit \ - tests/20-pipe-exit-1.exit \ - tests/20-pipe-sed-cat.stdout \ - tests/20-pipe-sed.stdout \ - tests/20-semi.exit \ - tests/30-for-substitution.stdout \ - tests/30-substitution-assignment-at.stdout \ - tests/30-substitution-assignment.stdout \ - tests/30-substitution-backtick.stdout \ - tests/30-substitution-redirect.stdout \ - tests/30-substitution-word.stdout \ - tests/30-substitution.stdout \ - tests/40-assignment-eval-echo.stdout \ - tests/40-eval-echo-variable.stdout \ - tests/40-eval.stdout \ - tests/41-dot.stdout \ - tests/42-export-new.stdout \ - tests/42-sh-export-new.stdout \ - tests/42-sh-export.stdout \ - tests/42-sh.stdout \ - tests/43-trap-subshell.stdout \ - tests/50-iohere.stdout \ - tests/50-redirect-append.stdout \ - tests/50-redirect-clobber.stdout \ - tests/50-redirect-in-out.stdout \ - tests/50-redirect-merge.stdout \ - tests/50-redirect-pipe.stdout \ - tests/50-redirect-sed.stdout \ - tests/50-redirect-space.stdout \ - tests/50-redirect.stdout \ - tests/60-function-at.stdout \ - tests/60-function.stdout \ - tests/70-hash-hash.stdout \ - tests/70-hash.stdout \ - tests/70-percent-percent.stdout \ - tests/70-percent-space.stdout \ - tests/70-percent.stdout \ - tests/70-slash-string.stdout \ - tests/70-slash.stdout \ - tests/100-cd-foo.exit \ - tests/100-cd.stdout \ tests/data/star/2 \ tests/data/star/3 \ tests/data/star/0 \ tests/data/star/1 \ tests/data/foo \ tests/data/diff.scm \ - tests/data/script.sh + tests/data/script.sh \ + tests/data/42-export-new.sh .PHONY: test-list test-list: ; @echo $(TESTS) EXTRA_DIST += \ $(TESTS) \ - $(BROKEN_TESTS) \ $(TEST_DATA_FILES) \ - test.sh \ tests/unit/automake.scm \ tests/spec/check-spec \ tests/spec/Makefile.am \ @@ -413,10 +227,8 @@ distcheck-hook: CLEANFILES += \ $(bin_SCRIPTS) \ - $(FULL_TESTS:tests/%.sh=tests/%.log) \ - $(FULL_TESTS:tests/%.sh=tests/%.trs) \ - $(FULL_TESTS:tests/%.sh=tests/%.1) \ - $(FULL_TESTS:tests/%.sh=tests/%.2) \ + $(FULL_TESTS:tests/%.org=tests/%.log) \ + $(FULL_TESTS:tests/%.org=tests/%.trs) \ $(UNIT_TESTS:tests/%.scm=tests/%.log) \ $(UNIT_TESTS:tests/%.scm=tests/%.trs) diff --git a/configure.ac b/configure.ac index 5cb200f..b2813a9 100644 --- a/configure.ac +++ b/configure.ac @@ -41,6 +41,7 @@ AC_CONFIG_FILES([Makefile]) AC_CONFIG_FILES([gash/config.scm]) AC_CONFIG_FILES([pre-inst-env:build-aux/pre-inst-env.in], [chmod +x pre-inst-env]) +AC_CONFIG_FILES([tests/run-test-suite], [chmod +x tests/run-test-suite]) AC_CONFIG_FILES([tests/unit/config.scm]) AC_CONFIG_FILES([tests/spec/Makefile]) AC_CONFIG_FILES([tools/coverage], [chmod +x tools/coverage]) diff --git a/test.sh b/test.sh deleted file mode 100755 index 60a4070..0000000 --- a/test.sh +++ /dev/null @@ -1,53 +0,0 @@ -# Gash --- Guile As SHell -# Copyright © 2016, 2017 R.E.W. van Beusekom -# Copyright © 2018 Jan (janneke) Nieuwenhuizen -# Copyright © 2018, 2019 Timothy Sample -# -# This file is part of Gash. -# -# Gash is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3 of the License, or (at -# your option) any later version. -# -# Gash is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with Gash. If not, see . - -set -e -if [ -n "$V" ]; then - set -x -fi -DIFF=${DIFF-diff} -TEST_SHELL=${TEST_SHELL-gash} - -t="$1" -s=tests/$(basename "$t" .sh) - -# This is a hack to make sure we can build from an external directory. -# We move into the source directory, and then send all of our output -# back to the build directory. -export TEST_TMP=$(pwd) -b=$(pwd)/$s -cd $(dirname "$t")/.. - -set +e -timeout 10 $TEST_SHELL -e "$s".sh -s --long file0 file1 > "$b".1 2> "$b".2 -r=$? -set -e -if [ -f "$s".exit ]; then - e=$(cat "$s".exit) -else - e=0 -fi -[ $r = $e ] || exit 1 -if [ -f "$s".stdout ]; then - $DIFF -u "$s".stdout "$b".1 -fi -if [ -f "$s".stderr ]; then - $DIFF -u "$s".stderr "$b".2 -fi diff --git a/tests/00-exit-0.sh b/tests/00-exit-0.sh deleted file mode 100644 index eec2061..0000000 --- a/tests/00-exit-0.sh +++ /dev/null @@ -1 +0,0 @@ -exit 0 \ No newline at end of file diff --git a/tests/00-exit-1.exit b/tests/00-exit-1.exit deleted file mode 100644 index d00491f..0000000 --- a/tests/00-exit-1.exit +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/tests/00-exit-1.sh b/tests/00-exit-1.sh deleted file mode 100644 index 6dedc57..0000000 --- a/tests/00-exit-1.sh +++ /dev/null @@ -1 +0,0 @@ -exit 1 \ No newline at end of file diff --git a/tests/00-exit-2.exit b/tests/00-exit-2.exit deleted file mode 100644 index 0cfbf08..0000000 --- a/tests/00-exit-2.exit +++ /dev/null @@ -1 +0,0 @@ -2 diff --git a/tests/00-exit-2.sh b/tests/00-exit-2.sh deleted file mode 100644 index 6b0593e..0000000 --- a/tests/00-exit-2.sh +++ /dev/null @@ -1 +0,0 @@ -exit 2 diff --git a/tests/00-exit-error.exit b/tests/00-exit-error.exit deleted file mode 100644 index 0cfbf08..0000000 --- a/tests/00-exit-error.exit +++ /dev/null @@ -1 +0,0 @@ -2 diff --git a/tests/00-exit-error.sh b/tests/00-exit-error.sh deleted file mode 100644 index aabd2d2..0000000 --- a/tests/00-exit-error.sh +++ /dev/null @@ -1,2 +0,0 @@ -set +e -ls /foo diff --git a/tests/00-exit-var.exit b/tests/00-exit-var.exit deleted file mode 100644 index 0cfbf08..0000000 --- a/tests/00-exit-var.exit +++ /dev/null @@ -1 +0,0 @@ -2 diff --git a/tests/00-exit-var.sh b/tests/00-exit-var.sh deleted file mode 100644 index 47b099a..0000000 --- a/tests/00-exit-var.sh +++ /dev/null @@ -1,3 +0,0 @@ -set +e -ls /foo -exit $? diff --git a/tests/00-exit.sh b/tests/00-exit.sh deleted file mode 100644 index ae3bc0a..0000000 --- a/tests/00-exit.sh +++ /dev/null @@ -1 +0,0 @@ -exit \ No newline at end of file diff --git a/tests/01-script-arg-0.sh b/tests/01-script-arg-0.sh deleted file mode 100644 index afb2377..0000000 --- a/tests/01-script-arg-0.sh +++ /dev/null @@ -1,2 +0,0 @@ -echo $0 - diff --git a/tests/01-script-arg-length.sh b/tests/01-script-arg-length.sh deleted file mode 100644 index bb03f7a..0000000 --- a/tests/01-script-arg-length.sh +++ /dev/null @@ -1 +0,0 @@ -echo $# diff --git a/tests/01-script-arg-length.stdout b/tests/01-script-arg-length.stdout deleted file mode 100644 index b8626c4..0000000 --- a/tests/01-script-arg-length.stdout +++ /dev/null @@ -1 +0,0 @@ -4 diff --git a/tests/01-script-arg-list.sh b/tests/01-script-arg-list.sh deleted file mode 100644 index 46445d8..0000000 --- a/tests/01-script-arg-list.sh +++ /dev/null @@ -1 +0,0 @@ -echo $@ diff --git a/tests/01-script-arg-list.stdout b/tests/01-script-arg-list.stdout deleted file mode 100644 index 48c3024..0000000 --- a/tests/01-script-arg-list.stdout +++ /dev/null @@ -1 +0,0 @@ --s --long file0 file1 diff --git a/tests/01-script-backslash-space.sh b/tests/01-script-backslash-space.sh deleted file mode 100644 index 872a36a..0000000 --- a/tests/01-script-backslash-space.sh +++ /dev/null @@ -1,4 +0,0 @@ -echo foo\ - bar baz\ - bla -echo diff --git a/tests/01-script-backslash-twice.exit b/tests/01-script-backslash-twice.exit deleted file mode 100644 index 0cfbf08..0000000 --- a/tests/01-script-backslash-twice.exit +++ /dev/null @@ -1 +0,0 @@ -2 diff --git a/tests/01-script-backslash-twice.sh b/tests/01-script-backslash-twice.sh deleted file mode 100644 index d6058cf..0000000 --- a/tests/01-script-backslash-twice.sh +++ /dev/null @@ -1,3 +0,0 @@ -exit \ -\ - 2 diff --git a/tests/01-script-backslash.exit b/tests/01-script-backslash.exit deleted file mode 100644 index 573541a..0000000 --- a/tests/01-script-backslash.exit +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/tests/01-script-backslash.sh b/tests/01-script-backslash.sh deleted file mode 100644 index 0e662fd..0000000 --- a/tests/01-script-backslash.sh +++ /dev/null @@ -1,2 +0,0 @@ -exit\ - 0 diff --git a/tests/01-script-newline.exit b/tests/01-script-newline.exit deleted file mode 100644 index 0cfbf08..0000000 --- a/tests/01-script-newline.exit +++ /dev/null @@ -1 +0,0 @@ -2 diff --git a/tests/01-script-newline.sh b/tests/01-script-newline.sh deleted file mode 100644 index b8d906f..0000000 --- a/tests/01-script-newline.sh +++ /dev/null @@ -1,2 +0,0 @@ -true -exit 2 diff --git a/tests/01-script-semi.exit b/tests/01-script-semi.exit deleted file mode 100644 index 0cfbf08..0000000 --- a/tests/01-script-semi.exit +++ /dev/null @@ -1 +0,0 @@ -2 diff --git a/tests/01-script-semi.sh b/tests/01-script-semi.sh deleted file mode 100644 index 41b351d..0000000 --- a/tests/01-script-semi.sh +++ /dev/null @@ -1 +0,0 @@ -true; exit 2 diff --git a/tests/01-script-shift.sh b/tests/01-script-shift.sh deleted file mode 100644 index 216dc45..0000000 --- a/tests/01-script-shift.sh +++ /dev/null @@ -1,9 +0,0 @@ -echo $@ -shift -echo $@ -shift -echo $@ -shift -echo $@ -shift -echo $@ diff --git a/tests/01-script-shift.stdout b/tests/01-script-shift.stdout deleted file mode 100644 index 2abb895..0000000 --- a/tests/01-script-shift.stdout +++ /dev/null @@ -1,5 +0,0 @@ --s --long file0 file1 ---long file0 file1 -file0 file1 -file1 - diff --git a/tests/03-echo-brace.sh b/tests/03-echo-brace.sh deleted file mode 100644 index 5e11003..0000000 --- a/tests/03-echo-brace.sh +++ /dev/null @@ -1 +0,0 @@ -echo foo:{bar} diff --git a/tests/03-echo-brace.stdout b/tests/03-echo-brace.stdout deleted file mode 100644 index 4f1b6f1..0000000 --- a/tests/03-echo-brace.stdout +++ /dev/null @@ -1 +0,0 @@ -foo:{bar} diff --git a/tests/03-echo-doublequotes.sh b/tests/03-echo-doublequotes.sh deleted file mode 100644 index 9236003..0000000 --- a/tests/03-echo-doublequotes.sh +++ /dev/null @@ -1 +0,0 @@ -echo "foo" b"ar" diff --git a/tests/03-echo-doublequotes.stdout b/tests/03-echo-doublequotes.stdout deleted file mode 100644 index d675fa4..0000000 --- a/tests/03-echo-doublequotes.stdout +++ /dev/null @@ -1 +0,0 @@ -foo bar diff --git a/tests/03-echo-escaped-doublequotes.sh b/tests/03-echo-escaped-doublequotes.sh deleted file mode 100644 index 125a6e5..0000000 --- a/tests/03-echo-escaped-doublequotes.sh +++ /dev/null @@ -1 +0,0 @@ -echo foo "bar" \"baz\" diff --git a/tests/03-echo-escaped-doublequotes.stdout b/tests/03-echo-escaped-doublequotes.stdout deleted file mode 100644 index 80a5f14..0000000 --- a/tests/03-echo-escaped-doublequotes.stdout +++ /dev/null @@ -1 +0,0 @@ -foo bar "baz" diff --git a/tests/03-echo-nesting.sh b/tests/03-echo-nesting.sh deleted file mode 100644 index efe83b8..0000000 --- a/tests/03-echo-nesting.sh +++ /dev/null @@ -1 +0,0 @@ -echo 'foo "bar"' diff --git a/tests/03-echo-nesting.stdout b/tests/03-echo-nesting.stdout deleted file mode 100644 index 5635c74..0000000 --- a/tests/03-echo-nesting.stdout +++ /dev/null @@ -1 +0,0 @@ -foo "bar" diff --git a/tests/03-echo-quoted-doublequotes.sh b/tests/03-echo-quoted-doublequotes.sh deleted file mode 100644 index 3e4148a..0000000 --- a/tests/03-echo-quoted-doublequotes.sh +++ /dev/null @@ -1 +0,0 @@ -echo foo "bar" '"baz"' diff --git a/tests/03-echo-quoted-doublequotes.stdout b/tests/03-echo-quoted-doublequotes.stdout deleted file mode 100644 index 80a5f14..0000000 --- a/tests/03-echo-quoted-doublequotes.stdout +++ /dev/null @@ -1 +0,0 @@ -foo bar "baz" diff --git a/tests/03-echo.sh b/tests/03-echo.sh deleted file mode 100644 index dccbe8e..0000000 --- a/tests/03-echo.sh +++ /dev/null @@ -1 +0,0 @@ -echo \ No newline at end of file diff --git a/tests/04-echo-equal.sh b/tests/04-echo-equal.sh deleted file mode 100644 index 86d3494..0000000 --- a/tests/04-echo-equal.sh +++ /dev/null @@ -1 +0,0 @@ -echo a=$a diff --git a/tests/04-echo-equal.stdout b/tests/04-echo-equal.stdout deleted file mode 100644 index 2afe6dc..0000000 --- a/tests/04-echo-equal.stdout +++ /dev/null @@ -1 +0,0 @@ -a= diff --git a/tests/04-echo-var.sh b/tests/04-echo-var.sh deleted file mode 100644 index e93c00f..0000000 --- a/tests/04-echo-var.sh +++ /dev/null @@ -1 +0,0 @@ -echo $SHELL \ No newline at end of file diff --git a/tests/04-echo-word-at-word.sh b/tests/04-echo-word-at-word.sh deleted file mode 100644 index 9f90b61..0000000 --- a/tests/04-echo-word-at-word.sh +++ /dev/null @@ -1 +0,0 @@ -echo command $@ plus diff --git a/tests/04-echo-word-at-word.stdout b/tests/04-echo-word-at-word.stdout deleted file mode 100644 index 802f789..0000000 --- a/tests/04-echo-word-at-word.stdout +++ /dev/null @@ -1 +0,0 @@ -command -s --long file0 file1 plus diff --git a/tests/04-echo-word-at.sh b/tests/04-echo-word-at.sh deleted file mode 100644 index b3ba18e..0000000 --- a/tests/04-echo-word-at.sh +++ /dev/null @@ -1 +0,0 @@ -echo command $@ diff --git a/tests/04-echo-word-at.stdout b/tests/04-echo-word-at.stdout deleted file mode 100644 index 6253d76..0000000 --- a/tests/04-echo-word-at.stdout +++ /dev/null @@ -1 +0,0 @@ -command -s --long file0 file1 diff --git a/tests/05-assignment-backtick.sh b/tests/05-assignment-backtick.sh deleted file mode 100644 index 51c6bf6..0000000 --- a/tests/05-assignment-backtick.sh +++ /dev/null @@ -1,3 +0,0 @@ -obj=ar.o -objs="$objs `basename $obj`" -echo "objs:>$objs<" diff --git a/tests/05-assignment-backtick.stdout b/tests/05-assignment-backtick.stdout deleted file mode 100644 index 2cde7c4..0000000 --- a/tests/05-assignment-backtick.stdout +++ /dev/null @@ -1 +0,0 @@ -objs:> ar.o< diff --git a/tests/05-assignment-double-quote.sh b/tests/05-assignment-double-quote.sh deleted file mode 100644 index 6b03911..0000000 --- a/tests/05-assignment-double-quote.sh +++ /dev/null @@ -1 +0,0 @@ -srcdir="." diff --git a/tests/05-assignment-doublequoted-doublequotes.sh b/tests/05-assignment-doublequoted-doublequotes.sh deleted file mode 100644 index 173a49a..0000000 --- a/tests/05-assignment-doublequoted-doublequotes.sh +++ /dev/null @@ -1,4 +0,0 @@ -aliaspath=alias -localedir=locale -defines="-DALIASPATH=\"${aliaspath}\" -DLOCALEDIR=\"${localedir}\"" -echo cc $defines diff --git a/tests/05-assignment-doublequoted-doublequotes.stdout b/tests/05-assignment-doublequoted-doublequotes.stdout deleted file mode 100644 index 4ea0763..0000000 --- a/tests/05-assignment-doublequoted-doublequotes.stdout +++ /dev/null @@ -1 +0,0 @@ -cc -DALIASPATH="alias" -DLOCALEDIR="locale" diff --git a/tests/05-assignment-echo.sh b/tests/05-assignment-echo.sh deleted file mode 100644 index eef32cd..0000000 --- a/tests/05-assignment-echo.sh +++ /dev/null @@ -1,2 +0,0 @@ -SHELL=/bin/bash -echo $SHELL diff --git a/tests/05-assignment-echo.stdout b/tests/05-assignment-echo.stdout deleted file mode 100644 index 01dca2d..0000000 --- a/tests/05-assignment-echo.stdout +++ /dev/null @@ -1 +0,0 @@ -/bin/bash diff --git a/tests/05-assignment-empty.sh b/tests/05-assignment-empty.sh deleted file mode 100644 index 049544d..0000000 --- a/tests/05-assignment-empty.sh +++ /dev/null @@ -1,2 +0,0 @@ -a= -echo a:$a diff --git a/tests/05-assignment-empty.stdout b/tests/05-assignment-empty.stdout deleted file mode 100644 index 46568d8..0000000 --- a/tests/05-assignment-empty.stdout +++ /dev/null @@ -1 +0,0 @@ -a: diff --git a/tests/05-assignment-singlequote.sh b/tests/05-assignment-singlequote.sh deleted file mode 100644 index 77f0bb1..0000000 --- a/tests/05-assignment-singlequote.sh +++ /dev/null @@ -1 +0,0 @@ -srcdir='.' diff --git a/tests/05-assignment-variable-word.sh b/tests/05-assignment-variable-word.sh deleted file mode 100644 index dbc2719..0000000 --- a/tests/05-assignment-variable-word.sh +++ /dev/null @@ -1,3 +0,0 @@ -SHELL=gash -bin=${SHELL}/bin -echo $bin diff --git a/tests/05-assignment-variable-word.stdout b/tests/05-assignment-variable-word.stdout deleted file mode 100644 index 567d244..0000000 --- a/tests/05-assignment-variable-word.stdout +++ /dev/null @@ -1 +0,0 @@ -gash/bin diff --git a/tests/05-assignment-word-variable.sh b/tests/05-assignment-word-variable.sh deleted file mode 100644 index 95d0e68..0000000 --- a/tests/05-assignment-word-variable.sh +++ /dev/null @@ -1,3 +0,0 @@ -SHELL=gash -PATH=bin:${SHELL} -echo $PATH diff --git a/tests/05-assignment-word-variable.stdout b/tests/05-assignment-word-variable.stdout deleted file mode 100644 index 62036dd..0000000 --- a/tests/05-assignment-word-variable.stdout +++ /dev/null @@ -1 +0,0 @@ -bin:gash diff --git a/tests/05-assignment.sh b/tests/05-assignment.sh deleted file mode 100644 index 835e1dc..0000000 --- a/tests/05-assignment.sh +++ /dev/null @@ -1 +0,0 @@ -SHELL=/bin/bash diff --git a/tests/06-command-compound-word.sh b/tests/06-command-compound-word.sh deleted file mode 100644 index 01fc7ea..0000000 --- a/tests/06-command-compound-word.sh +++ /dev/null @@ -1,4 +0,0 @@ -CC=echo -empty= -file=ar.o -$CC -I${empty} $file diff --git a/tests/06-command-compound-word.stdout b/tests/06-command-compound-word.stdout deleted file mode 100644 index 366e732..0000000 --- a/tests/06-command-compound-word.stdout +++ /dev/null @@ -1 +0,0 @@ --I ar.o diff --git a/tests/06-compound-word.sh b/tests/06-compound-word.sh deleted file mode 100644 index e806293..0000000 --- a/tests/06-compound-word.sh +++ /dev/null @@ -1,2 +0,0 @@ -srcdir=. -echo cc -c ${srcdir}/$file diff --git a/tests/06-compound-word.stdout b/tests/06-compound-word.stdout deleted file mode 100644 index 81f5a26..0000000 --- a/tests/06-compound-word.stdout +++ /dev/null @@ -1 +0,0 @@ -cc -c ./ diff --git a/tests/07-variable-not-or.sh b/tests/07-variable-not-or.sh deleted file mode 100644 index a52d13b..0000000 --- a/tests/07-variable-not-or.sh +++ /dev/null @@ -1,2 +0,0 @@ -foo=baz -echo ${foo-bar} diff --git a/tests/07-variable-not-or.stdout b/tests/07-variable-not-or.stdout deleted file mode 100644 index 7601807..0000000 --- a/tests/07-variable-not-or.stdout +++ /dev/null @@ -1 +0,0 @@ -baz diff --git a/tests/07-variable-or-doublequote.sh b/tests/07-variable-or-doublequote.sh deleted file mode 100644 index 04af4f2..0000000 --- a/tests/07-variable-or-doublequote.sh +++ /dev/null @@ -1,4 +0,0 @@ -CPPFLAGS=${CPPFLAGS-" --I ${srcdest}src -"} -echo $CPPFLAGS diff --git a/tests/07-variable-or-doublequote.stdout b/tests/07-variable-or-doublequote.stdout deleted file mode 100644 index 3bb5bf4..0000000 --- a/tests/07-variable-or-doublequote.stdout +++ /dev/null @@ -1 +0,0 @@ --I src diff --git a/tests/07-variable-or-empty.sh b/tests/07-variable-or-empty.sh deleted file mode 100644 index ba4f900..0000000 --- a/tests/07-variable-or-empty.sh +++ /dev/null @@ -1 +0,0 @@ -echo ${bindir-} diff --git a/tests/07-variable-or-empty.stdout b/tests/07-variable-or-empty.stdout deleted file mode 100644 index 8b13789..0000000 --- a/tests/07-variable-or-empty.stdout +++ /dev/null @@ -1 +0,0 @@ - diff --git a/tests/07-variable-or-slash.sh b/tests/07-variable-or-slash.sh deleted file mode 100644 index 4ac2f60..0000000 --- a/tests/07-variable-or-slash.sh +++ /dev/null @@ -1 +0,0 @@ -echo ${foo-bar/} diff --git a/tests/07-variable-or-variable.sh b/tests/07-variable-or-variable.sh deleted file mode 100644 index 3fe8df8..0000000 --- a/tests/07-variable-or-variable.sh +++ /dev/null @@ -1,2 +0,0 @@ -prefix=/usr -echo ${bindir-$prefix/bin} diff --git a/tests/07-variable-or-variable.stdout b/tests/07-variable-or-variable.stdout deleted file mode 100644 index 415f082..0000000 --- a/tests/07-variable-or-variable.stdout +++ /dev/null @@ -1 +0,0 @@ -/usr/bin diff --git a/tests/07-variable-or.sh b/tests/07-variable-or.sh deleted file mode 100644 index 4a2da2a..0000000 --- a/tests/07-variable-or.sh +++ /dev/null @@ -1 +0,0 @@ -echo ${foo-bar} diff --git a/tests/07-variable-or.stdout b/tests/07-variable-or.stdout deleted file mode 100644 index 5716ca5..0000000 --- a/tests/07-variable-or.stdout +++ /dev/null @@ -1 +0,0 @@ -bar diff --git a/tests/08-variable-and.sh b/tests/08-variable-and.sh deleted file mode 100644 index 3c5da46..0000000 --- a/tests/08-variable-and.sh +++ /dev/null @@ -1,2 +0,0 @@ -foo=baz -echo ${foo+bar} diff --git a/tests/08-variable-and.stdout b/tests/08-variable-and.stdout deleted file mode 100644 index 5716ca5..0000000 --- a/tests/08-variable-and.stdout +++ /dev/null @@ -1 +0,0 @@ -bar diff --git a/tests/08-variable-not-and.sh b/tests/08-variable-not-and.sh deleted file mode 100644 index af44487..0000000 --- a/tests/08-variable-not-and.sh +++ /dev/null @@ -1 +0,0 @@ -echo ${foo+bar} diff --git a/tests/08-variable-not-and.stdout b/tests/08-variable-not-and.stdout deleted file mode 100644 index 8b13789..0000000 --- a/tests/08-variable-not-and.stdout +++ /dev/null @@ -1 +0,0 @@ - diff --git a/tests/10-else-multiple.sh b/tests/10-else-multiple.sh deleted file mode 100644 index 4e36fb9..0000000 --- a/tests/10-else-multiple.sh +++ /dev/null @@ -1,6 +0,0 @@ -if false; then - : -else - echo one - echo two -fi diff --git a/tests/10-else.multiple.stdout b/tests/10-else.multiple.stdout deleted file mode 100644 index 814f4a4..0000000 --- a/tests/10-else.multiple.stdout +++ /dev/null @@ -1,2 +0,0 @@ -one -two diff --git a/tests/10-if-bracket-false.sh b/tests/10-if-bracket-false.sh deleted file mode 100644 index 1833999..0000000 --- a/tests/10-if-bracket-false.sh +++ /dev/null @@ -1,4 +0,0 @@ -if \[ 0 = 1 ]; then - exit 1 -fi -exit 0 diff --git a/tests/10-if-bracket.sh b/tests/10-if-bracket.sh deleted file mode 100644 index e16309c..0000000 --- a/tests/10-if-bracket.sh +++ /dev/null @@ -1,4 +0,0 @@ -if \[ 1 = 1 ]; then - exit 0 -fi -exit 1 diff --git a/tests/10-if-elif.sh b/tests/10-if-elif.sh deleted file mode 100644 index 8ec1e4e..0000000 --- a/tests/10-if-elif.sh +++ /dev/null @@ -1,8 +0,0 @@ -if false; then - exit 1 -elif false; then - exit 2 -else - exit 0 -fi -exit 1 diff --git a/tests/10-if-else.sh b/tests/10-if-else.sh deleted file mode 100644 index 9b34a0b..0000000 --- a/tests/10-if-else.sh +++ /dev/null @@ -1,6 +0,0 @@ -if false; then - exit 1 -else - exit 0 -fi -exit 1 diff --git a/tests/10-if-false.sh b/tests/10-if-false.sh deleted file mode 100644 index 04581c1..0000000 --- a/tests/10-if-false.sh +++ /dev/null @@ -1,4 +0,0 @@ -if false; then - exit 1 -fi -exit 0 diff --git a/tests/10-if-line.sh b/tests/10-if-line.sh deleted file mode 100644 index da0e6d8..0000000 --- a/tests/10-if-line.sh +++ /dev/null @@ -1 +0,0 @@ -if true; then echo yay; fi \ No newline at end of file diff --git a/tests/10-if-multiple.sh b/tests/10-if-multiple.sh deleted file mode 100644 index 4f46034..0000000 --- a/tests/10-if-multiple.sh +++ /dev/null @@ -1,4 +0,0 @@ -if true; then - echo one - echo two -fi diff --git a/tests/10-if-multiple.stdout b/tests/10-if-multiple.stdout deleted file mode 100644 index 814f4a4..0000000 --- a/tests/10-if-multiple.stdout +++ /dev/null @@ -1,2 +0,0 @@ -one -two diff --git a/tests/10-if-redirect.sh b/tests/10-if-redirect.sh deleted file mode 100644 index 9b269f6..0000000 --- a/tests/10-if-redirect.sh +++ /dev/null @@ -1,5 +0,0 @@ -if $SHELL --version | grep foobar 2>/dev/null; then - exit 1 -else - exit 0 -fi diff --git a/tests/10-if-test-false.sh b/tests/10-if-test-false.sh deleted file mode 100644 index 220020b..0000000 --- a/tests/10-if-test-false.sh +++ /dev/null @@ -1,4 +0,0 @@ -if test 0 = 1; then - exit 1 -fi -exit 0 diff --git a/tests/10-if-test.sh b/tests/10-if-test.sh deleted file mode 100644 index 8a93e47..0000000 --- a/tests/10-if-test.sh +++ /dev/null @@ -1,4 +0,0 @@ -if test 1 = 1; then - exit 0 -fi -exit 1 diff --git a/tests/10-if-word-variable.sh b/tests/10-if-word-variable.sh deleted file mode 100644 index cc347dc..0000000 --- a/tests/10-if-word-variable.sh +++ /dev/null @@ -1,4 +0,0 @@ -if \[ x"$y" = x ]; then - exit 0 -fi -exit 1 diff --git a/tests/10-if.sh b/tests/10-if.sh deleted file mode 100644 index f61cd14..0000000 --- a/tests/10-if.sh +++ /dev/null @@ -1,4 +0,0 @@ -if true; then - exit 0 -fi -exit 1 diff --git a/tests/100-bracket-file.sh b/tests/100-bracket-file.sh deleted file mode 100644 index 556197d..0000000 --- a/tests/100-bracket-file.sh +++ /dev/null @@ -1,4 +0,0 @@ -if \[ -f foo-bar ]; then - exit 1 -fi - diff --git a/tests/100-cd-foo.exit b/tests/100-cd-foo.exit deleted file mode 100644 index d00491f..0000000 --- a/tests/100-cd-foo.exit +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/tests/100-cd-foo.sh b/tests/100-cd-foo.sh deleted file mode 100644 index 92a9b5c..0000000 --- a/tests/100-cd-foo.sh +++ /dev/null @@ -1 +0,0 @@ -cd /foo diff --git a/tests/100-cd.sh b/tests/100-cd.sh deleted file mode 100644 index 1817731..0000000 --- a/tests/100-cd.sh +++ /dev/null @@ -1,2 +0,0 @@ -cd /tmp -pwd diff --git a/tests/100-cd.stdout b/tests/100-cd.stdout deleted file mode 100644 index ceeb05b..0000000 --- a/tests/100-cd.stdout +++ /dev/null @@ -1 +0,0 @@ -/tmp diff --git a/tests/100-test-false.sh b/tests/100-test-false.sh deleted file mode 100644 index 5b8f214..0000000 --- a/tests/100-test-false.sh +++ /dev/null @@ -1,6 +0,0 @@ -set +e -false -if test $? -ne 0; then - exit 0; -fi -exit 1 diff --git a/tests/100-test-file.sh b/tests/100-test-file.sh deleted file mode 100644 index ebf0f4c..0000000 --- a/tests/100-test-file.sh +++ /dev/null @@ -1,4 +0,0 @@ -if test -f foo-bar; then - exit 1 -fi - diff --git a/tests/100-test.sh b/tests/100-test.sh deleted file mode 100644 index 6e513ec..0000000 --- a/tests/100-test.sh +++ /dev/null @@ -1,3 +0,0 @@ -if test a = b; then - exit 1; -fi diff --git a/tests/11-for-done-subshell.sh b/tests/11-for-done-subshell.sh deleted file mode 100644 index 08ffa46..0000000 --- a/tests/11-for-done-subshell.sh +++ /dev/null @@ -1 +0,0 @@ -(for i in 0; do echo $i; done) diff --git a/tests/11-for-done-subshell.stdout b/tests/11-for-done-subshell.stdout deleted file mode 100644 index 573541a..0000000 --- a/tests/11-for-done-subshell.stdout +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/tests/11-for-split-sequence.sh b/tests/11-for-split-sequence.sh deleted file mode 100644 index 1ef55e4..0000000 --- a/tests/11-for-split-sequence.sh +++ /dev/null @@ -1,4 +0,0 @@ -one=1 -for i in 0 $one 2 $two_n_halve $two_n_quaaar and 3 ""; do - echo $i; -done diff --git a/tests/11-for-split-sequence.stdout b/tests/11-for-split-sequence.stdout deleted file mode 100644 index b1fc8b4..0000000 --- a/tests/11-for-split-sequence.stdout +++ /dev/null @@ -1,6 +0,0 @@ -0 -1 -2 -and -3 - diff --git a/tests/11-for.sh b/tests/11-for.sh deleted file mode 100644 index a647d4e..0000000 --- a/tests/11-for.sh +++ /dev/null @@ -1,3 +0,0 @@ -for i in 0 1 2; do - echo $i; -done diff --git a/tests/11-for.stdout b/tests/11-for.stdout deleted file mode 100644 index 4539bbf..0000000 --- a/tests/11-for.stdout +++ /dev/null @@ -1,3 +0,0 @@ -0 -1 -2 diff --git a/tests/20-and.exit b/tests/20-and.exit deleted file mode 100644 index 0cfbf08..0000000 --- a/tests/20-and.exit +++ /dev/null @@ -1 +0,0 @@ -2 diff --git a/tests/20-and.sh b/tests/20-and.sh deleted file mode 100644 index 495cfe4..0000000 --- a/tests/20-and.sh +++ /dev/null @@ -1 +0,0 @@ -true && exit 2 diff --git a/tests/20-exec.sh b/tests/20-exec.sh deleted file mode 100644 index 8bd0061..0000000 --- a/tests/20-exec.sh +++ /dev/null @@ -1,2 +0,0 @@ -exec true -false diff --git a/tests/20-or.sh b/tests/20-or.sh deleted file mode 100644 index 84ffdd6..0000000 --- a/tests/20-or.sh +++ /dev/null @@ -1 +0,0 @@ -false || true diff --git a/tests/20-pipe-exit-0.sh b/tests/20-pipe-exit-0.sh deleted file mode 100644 index d09faab..0000000 --- a/tests/20-pipe-exit-0.sh +++ /dev/null @@ -1 +0,0 @@ -false | true diff --git a/tests/20-pipe-exit-1.exit b/tests/20-pipe-exit-1.exit deleted file mode 100644 index 56a6051..0000000 --- a/tests/20-pipe-exit-1.exit +++ /dev/null @@ -1 +0,0 @@ -1 \ No newline at end of file diff --git a/tests/20-pipe-exit-1.sh b/tests/20-pipe-exit-1.sh deleted file mode 100644 index 8bfc37e..0000000 --- a/tests/20-pipe-exit-1.sh +++ /dev/null @@ -1 +0,0 @@ -true | false diff --git a/tests/20-pipe-sed-cat.sh b/tests/20-pipe-sed-cat.sh deleted file mode 100644 index e779482..0000000 --- a/tests/20-pipe-sed-cat.sh +++ /dev/null @@ -1 +0,0 @@ -echo -e 'a\nb\nc' tests/data/star/* | sed 's, ,\n,g' | cat diff --git a/tests/20-pipe-sed-cat.stdout b/tests/20-pipe-sed-cat.stdout deleted file mode 100644 index 9740514..0000000 --- a/tests/20-pipe-sed-cat.stdout +++ /dev/null @@ -1,7 +0,0 @@ -a -b -c -tests/data/star/0 -tests/data/star/1 -tests/data/star/2 -tests/data/star/3 diff --git a/tests/20-pipe-sed.sh b/tests/20-pipe-sed.sh deleted file mode 100644 index 06c296b..0000000 --- a/tests/20-pipe-sed.sh +++ /dev/null @@ -1 +0,0 @@ -echo -e 'a\nb\nc' tests/data/star/* | \sed 's, ,\n,g' diff --git a/tests/20-pipe-sed.stdout b/tests/20-pipe-sed.stdout deleted file mode 100644 index 9740514..0000000 --- a/tests/20-pipe-sed.stdout +++ /dev/null @@ -1,7 +0,0 @@ -a -b -c -tests/data/star/0 -tests/data/star/1 -tests/data/star/2 -tests/data/star/3 diff --git a/tests/20-semi.exit b/tests/20-semi.exit deleted file mode 100644 index d00491f..0000000 --- a/tests/20-semi.exit +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/tests/20-semi.sh b/tests/20-semi.sh deleted file mode 100644 index 67bf325..0000000 --- a/tests/20-semi.sh +++ /dev/null @@ -1,2 +0,0 @@ -# gash makes this into a pipeline, then uses `true''s exit status -false ; true diff --git a/tests/30-for-substitution.sh b/tests/30-for-substitution.sh deleted file mode 100644 index a216a82..0000000 --- a/tests/30-for-substitution.sh +++ /dev/null @@ -1,3 +0,0 @@ -for file in `echo foo.o bar.o`; do - echo compiling $file... -done diff --git a/tests/30-for-substitution.stdout b/tests/30-for-substitution.stdout deleted file mode 100644 index aff4123..0000000 --- a/tests/30-for-substitution.stdout +++ /dev/null @@ -1,2 +0,0 @@ -compiling foo.o... -compiling bar.o... diff --git a/tests/30-substitution-assignment-at.sh b/tests/30-substitution-assignment-at.sh deleted file mode 100644 index a888fd0..0000000 --- a/tests/30-substitution-assignment-at.sh +++ /dev/null @@ -1,2 +0,0 @@ -cmdline=$(echo " $@") -echo cmdline:$cmdline diff --git a/tests/30-substitution-assignment-at.stdout b/tests/30-substitution-assignment-at.stdout deleted file mode 100644 index 0f794c3..0000000 --- a/tests/30-substitution-assignment-at.stdout +++ /dev/null @@ -1 +0,0 @@ -cmdline: -s --long file0 file1 diff --git a/tests/30-substitution-assignment.sh b/tests/30-substitution-assignment.sh deleted file mode 100644 index 816efa7..0000000 --- a/tests/30-substitution-assignment.sh +++ /dev/null @@ -1,2 +0,0 @@ -echo=$(echo 1 2 3) -echo echo=$echo diff --git a/tests/30-substitution-assignment.stdout b/tests/30-substitution-assignment.stdout deleted file mode 100644 index 7e6732e..0000000 --- a/tests/30-substitution-assignment.stdout +++ /dev/null @@ -1 +0,0 @@ -echo=1 2 3 diff --git a/tests/30-substitution-backtick.sh b/tests/30-substitution-backtick.sh deleted file mode 100644 index f196ae2..0000000 --- a/tests/30-substitution-backtick.sh +++ /dev/null @@ -1 +0,0 @@ -echo `echo 1 2 3` diff --git a/tests/30-substitution-backtick.stdout b/tests/30-substitution-backtick.stdout deleted file mode 100644 index b85905e..0000000 --- a/tests/30-substitution-backtick.stdout +++ /dev/null @@ -1 +0,0 @@ -1 2 3 diff --git a/tests/30-substitution-redirect.sh b/tests/30-substitution-redirect.sh deleted file mode 100644 index 9bdbc0f..0000000 --- a/tests/30-substitution-redirect.sh +++ /dev/null @@ -1 +0,0 @@ -echo $(echo foo bar baz 2>/dev/null) diff --git a/tests/30-substitution-redirect.stdout b/tests/30-substitution-redirect.stdout deleted file mode 100644 index 1aeaedb..0000000 --- a/tests/30-substitution-redirect.stdout +++ /dev/null @@ -1 +0,0 @@ -foo bar baz diff --git a/tests/30-substitution-word.sh b/tests/30-substitution-word.sh deleted file mode 100644 index 69467ab..0000000 --- a/tests/30-substitution-word.sh +++ /dev/null @@ -1,2 +0,0 @@ -echo foo $(echo bar)/baz - diff --git a/tests/30-substitution-word.stdout b/tests/30-substitution-word.stdout deleted file mode 100644 index 1a1c7ad..0000000 --- a/tests/30-substitution-word.stdout +++ /dev/null @@ -1 +0,0 @@ -foo bar/baz diff --git a/tests/30-substitution.sh b/tests/30-substitution.sh deleted file mode 100644 index a5c0e5c..0000000 --- a/tests/30-substitution.sh +++ /dev/null @@ -1 +0,0 @@ -echo $(echo 1 2 3) diff --git a/tests/30-substitution.stdout b/tests/30-substitution.stdout deleted file mode 100644 index b85905e..0000000 --- a/tests/30-substitution.stdout +++ /dev/null @@ -1 +0,0 @@ -1 2 3 diff --git a/tests/40-assignment-eval-echo.sh b/tests/40-assignment-eval-echo.sh deleted file mode 100644 index 0bad8d8..0000000 --- a/tests/40-assignment-eval-echo.sh +++ /dev/null @@ -1,3 +0,0 @@ -foo=bar -baz=`eval echo ${foo}` -echo $baz diff --git a/tests/40-assignment-eval-echo.stdout b/tests/40-assignment-eval-echo.stdout deleted file mode 100644 index 5716ca5..0000000 --- a/tests/40-assignment-eval-echo.stdout +++ /dev/null @@ -1 +0,0 @@ -bar diff --git a/tests/40-eval-echo-variable.sh b/tests/40-eval-echo-variable.sh deleted file mode 100644 index 1d4916d..0000000 --- a/tests/40-eval-echo-variable.sh +++ /dev/null @@ -1,3 +0,0 @@ -foo=baz -bar=foo -eval echo '$'$bar diff --git a/tests/40-eval-echo-variable.stdout b/tests/40-eval-echo-variable.stdout deleted file mode 100644 index 7601807..0000000 --- a/tests/40-eval-echo-variable.stdout +++ /dev/null @@ -1 +0,0 @@ -baz diff --git a/tests/40-eval.sh b/tests/40-eval.sh deleted file mode 100644 index c5f9af1..0000000 --- a/tests/40-eval.sh +++ /dev/null @@ -1 +0,0 @@ -eval echo 0 diff --git a/tests/40-eval.stdout b/tests/40-eval.stdout deleted file mode 100644 index 573541a..0000000 --- a/tests/40-eval.stdout +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/tests/41-dot.sh b/tests/41-dot.sh deleted file mode 100644 index 9425769..0000000 --- a/tests/41-dot.sh +++ /dev/null @@ -1,2 +0,0 @@ -. tests/data/script.sh -echo $foo diff --git a/tests/41-dot.stdout b/tests/41-dot.stdout deleted file mode 100644 index 60839a9..0000000 --- a/tests/41-dot.stdout +++ /dev/null @@ -1,3 +0,0 @@ -foo:bar -bar: -bar diff --git a/tests/42-export-new.stdout b/tests/42-export-new.stdout deleted file mode 100644 index b09af09..0000000 --- a/tests/42-export-new.stdout +++ /dev/null @@ -1 +0,0 @@ -no VEE diff --git a/tests/42-sh-export-new.sh b/tests/42-sh-export-new.sh deleted file mode 100644 index b91291e..0000000 --- a/tests/42-sh-export-new.sh +++ /dev/null @@ -1,3 +0,0 @@ -export V - -. tests/42-export-new.sh diff --git a/tests/42-sh-export-new.stdout b/tests/42-sh-export-new.stdout deleted file mode 100644 index b09af09..0000000 --- a/tests/42-sh-export-new.stdout +++ /dev/null @@ -1 +0,0 @@ -no VEE diff --git a/tests/42-sh-export.sh b/tests/42-sh-export.sh deleted file mode 100644 index d11bcba..0000000 --- a/tests/42-sh-export.sh +++ /dev/null @@ -1,3 +0,0 @@ -bar=baz -export baz -sh tests/data/script.sh diff --git a/tests/42-sh-export.stdout b/tests/42-sh-export.stdout deleted file mode 100644 index 1d269f3..0000000 --- a/tests/42-sh-export.stdout +++ /dev/null @@ -1,2 +0,0 @@ -foo:bar -bar: diff --git a/tests/42-sh.sh b/tests/42-sh.sh deleted file mode 100644 index 55ad7d2..0000000 --- a/tests/42-sh.sh +++ /dev/null @@ -1,2 +0,0 @@ -sh tests/data/script.sh -echo $foo diff --git a/tests/42-sh.stdout b/tests/42-sh.stdout deleted file mode 100644 index 3b93b9c..0000000 --- a/tests/42-sh.stdout +++ /dev/null @@ -1,3 +0,0 @@ -foo:bar -bar: - diff --git a/tests/43-trap-subshell.sh b/tests/43-trap-subshell.sh deleted file mode 100644 index dc8eb21..0000000 --- a/tests/43-trap-subshell.sh +++ /dev/null @@ -1,5 +0,0 @@ -trap "rm /tmp/bar$$" 0 -echo foo > /tmp/bar$$ -cat /tmp/bar$$ -(exit 0) -cat /tmp/bar$$ diff --git a/tests/43-trap-subshell.stdout b/tests/43-trap-subshell.stdout deleted file mode 100644 index 0d55bed..0000000 --- a/tests/43-trap-subshell.stdout +++ /dev/null @@ -1,2 +0,0 @@ -foo -foo diff --git a/tests/50-iohere-builtin.sh b/tests/50-iohere-builtin.sh deleted file mode 100644 index c6c1126..0000000 --- a/tests/50-iohere-builtin.sh +++ /dev/null @@ -1,3 +0,0 @@ -\cat < $TEST_TMP/bar -echo foo >> $TEST_TMP/bar -cat $TEST_TMP/bar -rm $TEST_TMP/bar diff --git a/tests/50-redirect-append.stdout b/tests/50-redirect-append.stdout deleted file mode 100644 index 0d55bed..0000000 --- a/tests/50-redirect-append.stdout +++ /dev/null @@ -1,2 +0,0 @@ -foo -foo diff --git a/tests/50-redirect-clobber.sh b/tests/50-redirect-clobber.sh deleted file mode 100644 index 8ed65e3..0000000 --- a/tests/50-redirect-clobber.sh +++ /dev/null @@ -1,4 +0,0 @@ -echo foo > /tmp/bar$$ -cat /tmp/bar$$ -> /tmp/bar$$ -cat /tmp/bar$$ diff --git a/tests/50-redirect-clobber.stdout b/tests/50-redirect-clobber.stdout deleted file mode 100644 index 257cc56..0000000 --- a/tests/50-redirect-clobber.stdout +++ /dev/null @@ -1 +0,0 @@ -foo diff --git a/tests/50-redirect-in-out.sh b/tests/50-redirect-in-out.sh deleted file mode 100644 index 6aa8934..0000000 --- a/tests/50-redirect-in-out.sh +++ /dev/null @@ -1,3 +0,0 @@ -cat < tests/data/foo > /tmp/bar$$ -cat /tmp/bar$$ -rm /tmp/bar$$ diff --git a/tests/50-redirect-in-out.stdout b/tests/50-redirect-in-out.stdout deleted file mode 100644 index 86e041d..0000000 --- a/tests/50-redirect-in-out.stdout +++ /dev/null @@ -1,3 +0,0 @@ -foo -bar -baz diff --git a/tests/50-redirect-in.sh b/tests/50-redirect-in.sh deleted file mode 100644 index 60aa11e..0000000 --- a/tests/50-redirect-in.sh +++ /dev/null @@ -1 +0,0 @@ -\cat < tests/data/foo diff --git a/tests/50-redirect-merge.sh b/tests/50-redirect-merge.sh deleted file mode 100644 index 79e7a7c..0000000 --- a/tests/50-redirect-merge.sh +++ /dev/null @@ -1,5 +0,0 @@ -set +e -ls /bin/sh /bin/foo > bar 2>&1 -echo foo -cat bar -rm bar diff --git a/tests/50-redirect-merge.stdout b/tests/50-redirect-merge.stdout deleted file mode 100644 index 4e95736..0000000 --- a/tests/50-redirect-merge.stdout +++ /dev/null @@ -1,3 +0,0 @@ -foo -ls: cannot access '/bin/foo': No such file or directory -/bin/sh diff --git a/tests/50-redirect-pipe.sh b/tests/50-redirect-pipe.sh deleted file mode 100644 index 8c809e4..0000000 --- a/tests/50-redirect-pipe.sh +++ /dev/null @@ -1 +0,0 @@ -echo foo | grep foo 2>/dev/null diff --git a/tests/50-redirect-pipe.stdout b/tests/50-redirect-pipe.stdout deleted file mode 100644 index 257cc56..0000000 --- a/tests/50-redirect-pipe.stdout +++ /dev/null @@ -1 +0,0 @@ -foo diff --git a/tests/50-redirect-sed.sh b/tests/50-redirect-sed.sh deleted file mode 100644 index ee22797..0000000 --- a/tests/50-redirect-sed.sh +++ /dev/null @@ -1,6 +0,0 @@ -unset DESTDIR -sed \ - -e "s,^#! /bin/sh,#! /bin/GASH," \ - tests/data/diff.scm > $DESTDIR/tmp/diff.scm -cat $DESTDIR/tmp/diff.scm -rm $DESTDIR/tmp/diff.scm diff --git a/tests/50-redirect-sed.stdout b/tests/50-redirect-sed.stdout deleted file mode 100644 index bfc05fe..0000000 --- a/tests/50-redirect-sed.stdout +++ /dev/null @@ -1,3 +0,0 @@ -#! /bin/GASH -!# - diff --git a/tests/50-redirect-space.sh b/tests/50-redirect-space.sh deleted file mode 100644 index 7451564..0000000 --- a/tests/50-redirect-space.sh +++ /dev/null @@ -1,3 +0,0 @@ -echo foo > /tmp/bar$$ -cat /tmp/bar$$ -rm /tmp/bar$$ diff --git a/tests/50-redirect-space.stdout b/tests/50-redirect-space.stdout deleted file mode 100644 index 257cc56..0000000 --- a/tests/50-redirect-space.stdout +++ /dev/null @@ -1 +0,0 @@ -foo diff --git a/tests/50-redirect.sh b/tests/50-redirect.sh deleted file mode 100644 index 6aaecd9..0000000 --- a/tests/50-redirect.sh +++ /dev/null @@ -1,3 +0,0 @@ -echo foo 1>/tmp/bar$$ -cat /tmp/bar$$ -rm /tmp/bar$$ diff --git a/tests/50-redirect.stdout b/tests/50-redirect.stdout deleted file mode 100644 index 257cc56..0000000 --- a/tests/50-redirect.stdout +++ /dev/null @@ -1 +0,0 @@ -foo diff --git a/tests/60-function-at.sh b/tests/60-function-at.sh deleted file mode 100644 index e16cc62..0000000 --- a/tests/60-function-at.sh +++ /dev/null @@ -1,8 +0,0 @@ -foo () { - echo $#:$@ - echo 0:$0 - echo 1:$1 - echo 2:$2 -} - -foo -v $@ diff --git a/tests/60-function-at.stdout b/tests/60-function-at.stdout deleted file mode 100644 index 6a08d7b..0000000 --- a/tests/60-function-at.stdout +++ /dev/null @@ -1,4 +0,0 @@ -5:-v -s --long file0 file1 -0:tests/60-function-at.sh -1:-v -2:-s diff --git a/tests/60-function.sh b/tests/60-function.sh deleted file mode 100644 index 4b0ef4b..0000000 --- a/tests/60-function.sh +++ /dev/null @@ -1,8 +0,0 @@ -foo () { - echo $1 -} - -echo before -foo bar -foo baz -echo after diff --git a/tests/60-function.stdout b/tests/60-function.stdout deleted file mode 100644 index 1de9ad8..0000000 --- a/tests/60-function.stdout +++ /dev/null @@ -1,4 +0,0 @@ -before -bar -baz -after diff --git a/tests/60-subst.sh b/tests/60-subst.sh deleted file mode 100644 index 271d6f0..0000000 --- a/tests/60-subst.sh +++ /dev/null @@ -1,9 +0,0 @@ -subst () { - sed \ - -e s",foo,bar,"\ - $1 > $2 -} - -subst tests/data/foo $TEST_TMP/foo.tmp -cat $TEST_TMP/foo.tmp -rm $TEST_TMP/foo.tmp diff --git a/tests/70-hash-hash.sh b/tests/70-hash-hash.sh deleted file mode 100644 index bdbec5c..0000000 --- a/tests/70-hash-hash.sh +++ /dev/null @@ -1,2 +0,0 @@ -file=dir/sub/name.ext -echo ${file##*/} diff --git a/tests/70-hash-hash.stdout b/tests/70-hash-hash.stdout deleted file mode 100644 index a6726fb..0000000 --- a/tests/70-hash-hash.stdout +++ /dev/null @@ -1 +0,0 @@ -name.ext diff --git a/tests/70-hash.sh b/tests/70-hash.sh deleted file mode 100644 index b4b9c02..0000000 --- a/tests/70-hash.sh +++ /dev/null @@ -1,2 +0,0 @@ -file=dir/sub/name.ext -echo ${file#*/} diff --git a/tests/70-hash.stdout b/tests/70-hash.stdout deleted file mode 100644 index 2d658b6..0000000 --- a/tests/70-hash.stdout +++ /dev/null @@ -1 +0,0 @@ -sub/name.ext diff --git a/tests/70-percent-percent.sh b/tests/70-percent-percent.sh deleted file mode 100644 index 47dcc3c..0000000 --- a/tests/70-percent-percent.sh +++ /dev/null @@ -1,2 +0,0 @@ -file=dir/sub/name.ext -echo ${file%%/*} diff --git a/tests/70-percent-percent.stdout b/tests/70-percent-percent.stdout deleted file mode 100644 index 0d2ecd7..0000000 --- a/tests/70-percent-percent.stdout +++ /dev/null @@ -1 +0,0 @@ -dir diff --git a/tests/70-percent-space.sh b/tests/70-percent-space.sh deleted file mode 100644 index 512072d..0000000 --- a/tests/70-percent-space.sh +++ /dev/null @@ -1,2 +0,0 @@ -args="--prefix=/usr " -echo ${args% *}/ diff --git a/tests/70-percent-space.stdout b/tests/70-percent-space.stdout deleted file mode 100644 index bc89cc9..0000000 --- a/tests/70-percent-space.stdout +++ /dev/null @@ -1 +0,0 @@ ---prefix=/usr/ diff --git a/tests/70-percent.sh b/tests/70-percent.sh deleted file mode 100644 index af50281..0000000 --- a/tests/70-percent.sh +++ /dev/null @@ -1,2 +0,0 @@ -file=dir/sub/name.ext -echo ${file%/*} diff --git a/tests/70-percent.stdout b/tests/70-percent.stdout deleted file mode 100644 index 86da852..0000000 --- a/tests/70-percent.stdout +++ /dev/null @@ -1 +0,0 @@ -dir/sub diff --git a/tests/70-slash-string-slash.sh b/tests/70-slash-string-slash.sh deleted file mode 100644 index 4b4c961..0000000 --- a/tests/70-slash-string-slash.sh +++ /dev/null @@ -1,2 +0,0 @@ -var='xxfooxx' -echo "${var/foo/bar/}" diff --git a/tests/70-slash-string.sh b/tests/70-slash-string.sh deleted file mode 100644 index 731949c..0000000 --- a/tests/70-slash-string.sh +++ /dev/null @@ -1,2 +0,0 @@ -var='xxfooxx' -echo "${var/foo/bar}" diff --git a/tests/70-slash-string.stdout b/tests/70-slash-string.stdout deleted file mode 100644 index 354f98b..0000000 --- a/tests/70-slash-string.stdout +++ /dev/null @@ -1 +0,0 @@ -xxbarxx diff --git a/tests/70-slash.sh b/tests/70-slash.sh deleted file mode 100644 index 717a26c..0000000 --- a/tests/70-slash.sh +++ /dev/null @@ -1,2 +0,0 @@ -var='xxfooxx' -echo "${var/foo}" diff --git a/tests/70-slash.stdout b/tests/70-slash.stdout deleted file mode 100644 index 63fc813..0000000 --- a/tests/70-slash.stdout +++ /dev/null @@ -1 +0,0 @@ -xxxx diff --git a/tests/README b/tests/README deleted file mode 100644 index 1736240..0000000 --- a/tests/README +++ /dev/null @@ -1,256 +0,0 @@ -Copyright and license notices for tests -*************************************** - -Copyright © 2019 Timothy Sample - -Copying and distribution of this file, with or without modification, -are permitted in any medium without royalty provided the copyright -notice and this notice are preserved. This file is offered as-is, -without warranty of any kind. - -Introduction -============ - -There are many small test scripts in this directory that are meant to -be interpreted by Gash as a means of testing Gash. Including -copyright and license notices in the files themselves is undesirable -for two reasons. - -The first reason is technical. Including comments in the scripts -subtly changes how they work, since they would then be implicitly -testing Gash's ability to parse comments in addition to whatever else -they are intended to test. - -The second reason is practical. There are very many very small test -scripts. The files are usually much shorter than a normal license -notice. In the hopes of making the files easier to understand and to -use, we prefer not to include a license notice in each one. - -To this end, this document provides the copyright and license notices -for the test files rather than the files themselves. - -Notices -======= - -The following list of files will be referred to later as "these -files": - - tests/00-exit-0.sh - tests/00-exit-1.exit - tests/00-exit-1.sh - tests/00-exit-2.exit - tests/00-exit-2.sh - tests/00-exit-error.exit - tests/00-exit-error.sh - tests/00-exit.sh - tests/00-exit-var.exit - tests/00-exit-var.sh - tests/01-script-arg-0.sh - tests/01-script-arg-length.sh - tests/01-script-arg-length.stdout - tests/01-script-arg-list.sh - tests/01-script-arg-list.stdout - tests/01-script-backslash.exit - tests/01-script-backslash.sh - tests/01-script-backslash-space.sh - tests/01-script-backslash-twice.exit - tests/01-script-backslash-twice.sh - tests/01-script-newline.exit - tests/01-script-newline.sh - tests/01-script-semi.exit - tests/01-script-semi.sh - tests/01-script-shift.sh - tests/01-script-shift.stdout - tests/03-echo-brace.sh - tests/03-echo-brace.stdout - tests/03-echo-doublequotes.sh - tests/03-echo-doublequotes.stdout - tests/03-echo-escaped-doublequotes.sh - tests/03-echo-escaped-doublequotes.stdout - tests/03-echo-nesting.sh - tests/03-echo-nesting.stdout - tests/03-echo-quoted-doublequotes.sh - tests/03-echo-quoted-doublequotes.stdout - tests/03-echo.sh - tests/04-echo-equal.sh - tests/04-echo-equal.stdout - tests/04-echo-var.sh - tests/04-echo-word-at.sh - tests/04-echo-word-at.stdout - tests/04-echo-word-at-word.sh - tests/04-echo-word-at-word.stdout - tests/05-assignment-backtick.sh - tests/05-assignment-backtick.stdout - tests/05-assignment-doublequoted-doublequotes.sh - tests/05-assignment-doublequoted-doublequotes.stdout - tests/05-assignment-double-quote.sh - tests/05-assignment-echo.sh - tests/05-assignment-echo.stdout - tests/05-assignment-empty.sh - tests/05-assignment-empty.stdout - tests/05-assignment.sh - tests/05-assignment-singlequote.sh - tests/05-assignment-variable-word.sh - tests/05-assignment-variable-word.stdout - tests/05-assignment-word-variable.sh - tests/05-assignment-word-variable.stdout - tests/06-command-compound-word.sh - tests/06-command-compound-word.stdout - tests/06-compound-word.sh - tests/06-compound-word.stdout - tests/07-variable-not-or.sh - tests/07-variable-not-or.stdout - tests/07-variable-or-doublequote.sh - tests/07-variable-or-doublequote.stdout - tests/07-variable-or-empty.sh - tests/07-variable-or-empty.stdout - tests/07-variable-or.sh - tests/07-variable-or-slash.sh - tests/07-variable-or.stdout - tests/07-variable-or-variable.sh - tests/07-variable-or-variable.stdout - tests/08-variable-and.sh - tests/08-variable-and.stdout - tests/08-variable-not-and.sh - tests/08-variable-not-and.stdout - tests/10-else-multiple.sh - tests/10-else.multiple.stdout - tests/10-if-bracket-false.sh - tests/10-if-bracket.sh - tests/10-if-elif.sh - tests/10-if-else.sh - tests/10-if-false.sh - tests/10-if-line.sh - tests/10-if-multiple.sh - tests/10-if-multiple.stdout - tests/10-if-redirect.sh - tests/10-if.sh - tests/10-if-test-false.sh - tests/10-if-test.sh - tests/10-if-word-variable.sh - tests/11-for-done-subshell.sh - tests/11-for-done-subshell.stdout - tests/11-for.sh - tests/11-for-split-sequence.sh - tests/11-for-split-sequence.stdout - tests/11-for.stdout - tests/20-and.exit - tests/20-and.sh - tests/20-exec.sh - tests/20-or.sh - tests/20-pipe-exit-0.sh - tests/20-pipe-exit-1.exit - tests/20-pipe-exit-1.sh - tests/20-pipe-sed-cat.sh - tests/20-pipe-sed-cat.stdout - tests/20-pipe-sed.sh - tests/20-pipe-sed.stdout - tests/20-semi.exit - tests/20-semi.sh - tests/30-for-substitution.sh - tests/30-for-substitution.stdout - tests/30-substitution-assignment-at.sh - tests/30-substitution-assignment-at.stdout - tests/30-substitution-assignment.sh - tests/30-substitution-assignment.stdout - tests/30-substitution-backtick.sh - tests/30-substitution-backtick.stdout - tests/30-substitution-redirect.sh - tests/30-substitution-redirect.stdout - tests/30-substitution.sh - tests/30-substitution.stdout - tests/30-substitution-word.sh - tests/30-substitution-word.stdout - tests/40-assignment-eval-echo.sh - tests/40-assignment-eval-echo.stdout - tests/40-eval-echo-variable.sh - tests/40-eval-echo-variable.stdout - tests/40-eval.sh - tests/40-eval.stdout - tests/41-dot.sh - tests/41-dot.stdout - tests/42-export-new.sh - tests/42-export-new.stdout - tests/42-sh-export-new.sh - tests/42-sh-export-new.stdout - tests/42-sh-export.sh - tests/42-sh-export.stdout - tests/42-sh.sh - tests/42-sh.stdout - tests/43-trap-subshell.sh - tests/43-trap-subshell.stdout - tests/50-iohere-builtin.sh - tests/50-iohere.sh - tests/50-iohere.stdout - tests/50-redirect-append.sh - tests/50-redirect-append.stdout - tests/50-redirect-clobber.sh - tests/50-redirect-clobber.stdout - tests/50-redirect-in-out.sh - tests/50-redirect-in-out.stdout - tests/50-redirect-in.sh - tests/50-redirect-merge.sh - tests/50-redirect-merge.stdout - tests/50-redirect-pipe.sh - tests/50-redirect-pipe.stdout - tests/50-redirect-sed.sh - tests/50-redirect-sed.stdout - tests/50-redirect.sh - tests/50-redirect-space.sh - tests/50-redirect-space.stdout - tests/50-redirect.stdout - tests/60-function-at.sh - tests/60-function-at.stdout - tests/60-function.sh - tests/60-function.stdout - tests/60-subst.sh - tests/70-hash-hash.sh - tests/70-hash-hash.stdout - tests/70-hash.sh - tests/70-hash.stdout - tests/70-percent-percent.sh - tests/70-percent-percent.stdout - tests/70-percent.sh - tests/70-percent-space.sh - tests/70-percent-space.stdout - tests/70-percent.stdout - tests/70-slash.sh - tests/70-slash.stdout - tests/70-slash-string.sh - tests/70-slash-string-slash.sh - tests/70-slash-string.stdout - tests/100-bracket-file.sh - tests/100-cd-foo.exit - tests/100-cd-foo.sh - tests/100-cd.sh - tests/100-cd.stdout - tests/100-test-false.sh - tests/100-test-file.sh - tests/100-test.sh - tests/data/diff.scm - tests/data/foo - tests/data/script.sh - tests/data/star/0 - tests/data/star/1 - tests/data/star/2 - tests/data/star/3 - -These files are: - -Copyright © 2016, 2017, 2018 R.E.W. van Beusekom -Copyright © 2018, 2019 Jan (janneke) Nieuwenhuizen - -These files are part of Gash. - -Gash is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. - -Gash is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with Gash. If not, see . diff --git a/tests/arguments.org b/tests/arguments.org new file mode 100644 index 0000000..fd163a5 --- /dev/null +++ b/tests/arguments.org @@ -0,0 +1,111 @@ +;;; Gash -- Guile As SHell +;;; Copyright © 2016, 2017, 2018 R.E.W. van Beusekom +;;; Copyright © 2018, 2019 Jan (janneke) Nieuwenhuizen +;;; Copyright © 2019 Timothy Sample +;;; +;;; This file is part of Gash. +;;; +;;; Gash is free software: you can redistribute it and/or modify +;;; it under the terms of the GNU General Public License as published by +;;; the Free Software Foundation, either version 3 of the License, or +;;; (at your option) any later version. +;;; +;;; Gash is distributed in the hope that it will be useful, +;;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;;; GNU General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with Gash. If not, see . + +* script-arg-0 +:script: +#+begin_src sh + echo $0 +#+end_src + +* script-arg-length +:script: +#+begin_src sh + echo $# +#+end_src +:args: ("-s" "--long" "file0" "file1") +:stdout: +#+begin_example + 4 +#+end_example + +* script-arg-list +:script: +#+begin_src sh + echo $@ +#+end_src +:args: ("-s" "--long" "file0" "file1") +:stdout: +#+begin_example + -s --long file0 file1 +#+end_example + +* script-backslash +:script: +#+begin_src sh + exit\ + 0 +#+end_src +:status: 0 + +* script-backslash-space +:script: +#+begin_src sh + echo foo\ + bar baz\ + bla + echo +#+end_src + +* script-backslash-twice +:script: +#+begin_src sh + exit \ + \ + 2 +#+end_src +:status: 2 + +* script-newline +:script: +#+begin_src sh + true + exit 2 +#+end_src +:status: 2 + +* script-semi +:script: +#+begin_src sh + true; exit 2 +#+end_src +:status: 2 + +* script-shift +:script: +#+begin_src sh + echo $@ + shift + echo $@ + shift + echo $@ + shift + echo $@ + shift + echo $@ +#+end_src +:args: ("-s" "--long" "file0" "file1") +:stdout: +#+begin_example + -s --long file0 file1 + --long file0 file1 + file0 file1 + file1 + +#+end_example diff --git a/tests/assignments.org b/tests/assignments.org new file mode 100644 index 0000000..bae3a05 --- /dev/null +++ b/tests/assignments.org @@ -0,0 +1,108 @@ +;;; Gash -- Guile As SHell +;;; Copyright © 2016, 2017, 2018 R.E.W. van Beusekom +;;; Copyright © 2018, 2019 Jan (janneke) Nieuwenhuizen +;;; Copyright © 2019 Timothy Sample +;;; +;;; This file is part of Gash. +;;; +;;; Gash is free software: you can redistribute it and/or modify +;;; it under the terms of the GNU General Public License as published by +;;; the Free Software Foundation, either version 3 of the License, or +;;; (at your option) any later version. +;;; +;;; Gash is distributed in the hope that it will be useful, +;;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;;; GNU General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with Gash. If not, see . + +* assignment-backtick +:script: +#+begin_src sh + obj=ar.o + objs="$objs `basename $obj`" + echo "objs:>$objs<" +#+end_src +:stdout: +#+begin_example + objs:> ar.o< +#+end_example + +* assignment-doublequoted-doublequotes +:script: +#+begin_src sh + aliaspath=alias + localedir=locale + defines="-DALIASPATH=\"${aliaspath}\" -DLOCALEDIR=\"${localedir}\"" + echo cc $defines +#+end_src +:stdout: +#+begin_example + cc -DALIASPATH="alias" -DLOCALEDIR="locale" +#+end_example + +* assignment-double-quote +:script: +#+begin_src sh + srcdir="." +#+end_src + +* assignment-echo +:script: +#+begin_src sh + SHELL=/bin/bash + echo $SHELL +#+end_src +:stdout: +#+begin_example + /bin/bash +#+end_example + +* assignment-empty +:script: +#+begin_src sh + a= + echo a:$a +#+end_src +:stdout: +#+begin_example + a: +#+end_example + +* assignment +:script: +#+begin_src sh + SHELL=/bin/bash +#+end_src + +* assignment-singlequote +:script: +#+begin_src sh + srcdir='.' +#+end_src + +* assignment-variable-word +:script: +#+begin_src sh + SHELL=gash + bin=${SHELL}/bin + echo $bin +#+end_src +:stdout: +#+begin_example + gash/bin +#+end_example + +* assignment-word-variable +:script: +#+begin_src sh + SHELL=gash + PATH=bin:${SHELL} + echo $PATH +#+end_src +:stdout: +#+begin_example + bin:gash +#+end_example diff --git a/tests/command-substitution.org b/tests/command-substitution.org new file mode 100644 index 0000000..4766434 --- /dev/null +++ b/tests/command-substitution.org @@ -0,0 +1,95 @@ +;;; Gash -- Guile As SHell +;;; Copyright © 2016, 2017, 2018 R.E.W. van Beusekom +;;; Copyright © 2018, 2019 Jan (janneke) Nieuwenhuizen +;;; Copyright © 2019 Timothy Sample +;;; +;;; This file is part of Gash. +;;; +;;; Gash is free software: you can redistribute it and/or modify +;;; it under the terms of the GNU General Public License as published by +;;; the Free Software Foundation, either version 3 of the License, or +;;; (at your option) any later version. +;;; +;;; Gash is distributed in the hope that it will be useful, +;;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;;; GNU General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with Gash. If not, see . + +* for-substitution +:script: +#+begin_src sh + for file in `echo foo.o bar.o`; do + echo compiling $file... + done +#+end_src +:stdout: +#+begin_example + compiling foo.o... + compiling bar.o... +#+end_example + +* substitution-assignment-at +:script: +#+begin_src sh + cmdline=$(echo " $@") + echo cmdline:$cmdline +#+end_src +:args: ("-s" "--long" "file0" "file1") +:stdout: +#+begin_example + cmdline: -s --long file0 file1 +#+end_example + +* substitution-assignment +:script: +#+begin_src sh + echo=$(echo 1 2 3) + echo echo=$echo +#+end_src +:stdout: +#+begin_example + echo=1 2 3 +#+end_example + +* substitution-backtick +:script: +#+begin_src sh + echo `echo 1 2 3` +#+end_src +:stdout: +#+begin_example + 1 2 3 +#+end_example + +* substitution-redirect +:script: +#+begin_src sh + echo $(echo foo bar baz 2>/dev/null) +#+end_src +:stdout: +#+begin_example + foo bar baz +#+end_example + +* substitution +:script: +#+begin_src sh + echo $(echo 1 2 3) +#+end_src +:stdout: +#+begin_example + 1 2 3 +#+end_example + +* substitution-word +:script: +#+begin_src sh + echo foo $(echo bar)/baz +#+end_src +:stdout: +#+begin_example + foo bar/baz +#+end_example diff --git a/tests/compound-words.org b/tests/compound-words.org new file mode 100644 index 0000000..3844bbc --- /dev/null +++ b/tests/compound-words.org @@ -0,0 +1,43 @@ +;;; Gash -- Guile As SHell +;;; Copyright © 2016, 2017, 2018 R.E.W. van Beusekom +;;; Copyright © 2018, 2019 Jan (janneke) Nieuwenhuizen +;;; Copyright © 2019 Timothy Sample +;;; +;;; This file is part of Gash. +;;; +;;; Gash is free software: you can redistribute it and/or modify +;;; it under the terms of the GNU General Public License as published by +;;; the Free Software Foundation, either version 3 of the License, or +;;; (at your option) any later version. +;;; +;;; Gash is distributed in the hope that it will be useful, +;;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;;; GNU General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with Gash. If not, see . + +* command-compound-word +:script: +#+begin_src sh + CC=echo + empty= + file=ar.o + $CC -I${empty} $file +#+end_src +:stdout: +#+begin_example + -I ar.o +#+end_example + +* compound-word +:script: +#+begin_src sh + srcdir=. + echo cc -c ${srcdir}/$file +#+end_src +:stdout: +#+begin_example + cc -c ./ +#+end_example diff --git a/tests/conditionals.org b/tests/conditionals.org new file mode 100644 index 0000000..df4d966 --- /dev/null +++ b/tests/conditionals.org @@ -0,0 +1,147 @@ +;;; Gash -- Guile As SHell +;;; Copyright © 2016, 2017, 2018 R.E.W. van Beusekom +;;; Copyright © 2018, 2019 Jan (janneke) Nieuwenhuizen +;;; Copyright © 2019 Timothy Sample +;;; +;;; This file is part of Gash. +;;; +;;; Gash is free software: you can redistribute it and/or modify +;;; it under the terms of the GNU General Public License as published by +;;; the Free Software Foundation, either version 3 of the License, or +;;; (at your option) any later version. +;;; +;;; Gash is distributed in the hope that it will be useful, +;;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;;; GNU General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with Gash. If not, see . + +* else-multiple +:script: +#+begin_src sh + if false; then + : + else + echo one + echo two + fi +#+end_src + +* if-bracket-false +:script: +#+begin_src sh + if \[ 0 = 1 ]; then + exit 1 + fi + exit 0 +#+end_src + +* if-bracket +:script: +#+begin_src sh + if \[ 1 = 1 ]; then + exit 0 + fi + exit 1 +#+end_src + +* if-elif +:script: +#+begin_src sh + if false; then + exit 1 + elif false; then + exit 2 + else + exit 0 + fi + exit 1 +#+end_src + +* if-else +:script: +#+begin_src sh + if false; then + exit 1 + else + exit 0 + fi + exit 1 +#+end_src + +* if-false +:script: +#+begin_src sh + if false; then + exit 1 + fi + exit 0 +#+end_src + +* if-line +:script: +#+begin_src sh + if true; then echo yay; fi +#+end_src + +* if-multiple +:script: +#+begin_src sh + if true; then + echo one + echo two + fi +#+end_src +:stdout: +#+begin_example + one + two +#+end_example + +* if-redirect +:script: +#+begin_src sh + if $SHELL --version | grep foobar 2>/dev/null; then + exit 1 + else + exit 0 + fi +#+end_src + +* if +:script: +#+begin_src sh + if true; then + exit 0 + fi + exit 1 +#+end_src + +* if-test-false +:script: +#+begin_src sh + if test 0 = 1; then + exit 1 + fi + exit 0 +#+end_src + +* if-test +:script: +#+begin_src sh + if test 1 = 1; then + exit 0 + fi + exit 1 +#+end_src + +* if-word-variable +:script: +#+begin_src sh + if \[ x"$y" = x ]; then + exit 0 + fi + exit 1 +#+end_src diff --git a/tests/42-export-new.sh b/tests/data/42-export-new.sh similarity index 100% rename from tests/42-export-new.sh rename to tests/data/42-export-new.sh diff --git a/tests/data/README b/tests/data/README new file mode 100644 index 0000000..d4316bd --- /dev/null +++ b/tests/data/README @@ -0,0 +1,51 @@ +Copyright and license notices for test data +******************************************* + +Copyright © 2019 Timothy Sample + +Copying and distribution of this file, with or without modification, +are permitted in any medium without royalty provided the copyright +notice and this notice are preserved. This file is offered as-is, +without warranty of any kind. + +Introduction +============ + +This directory contains small files used as part of the Gash test +suite. Since the files cannot contain comments themselves, this +document provides their copyright and license notices. + +Notices +======= + +The following list of files will be referred to later as "these +files": + + tests/data/42-export-new.sh + tests/data/diff.scm + tests/data/foo + tests/data/script.sh + tests/data/star/0 + tests/data/star/1 + tests/data/star/2 + tests/data/star/3 + +These files are: + +Copyright © 2016, 2017, 2018 R.E.W. van Beusekom +Copyright © 2018, 2019 Jan (janneke) Nieuwenhuizen + +These files are part of Gash. + +Gash is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +Gash is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with Gash. If not, see . diff --git a/tests/dot.org b/tests/dot.org new file mode 100644 index 0000000..2ab585c --- /dev/null +++ b/tests/dot.org @@ -0,0 +1,32 @@ +;;; Gash -- Guile As SHell +;;; Copyright © 2016, 2017, 2018 R.E.W. van Beusekom +;;; Copyright © 2018, 2019 Jan (janneke) Nieuwenhuizen +;;; Copyright © 2019 Timothy Sample +;;; +;;; This file is part of Gash. +;;; +;;; Gash is free software: you can redistribute it and/or modify +;;; it under the terms of the GNU General Public License as published by +;;; the Free Software Foundation, either version 3 of the License, or +;;; (at your option) any later version. +;;; +;;; Gash is distributed in the hope that it will be useful, +;;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;;; GNU General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with Gash. If not, see . + +* dot +:script: +#+begin_src sh + . tests/data/script.sh + echo $foo +#+end_src +:stdout: +#+begin_example + foo:bar + bar: + bar +#+end_example diff --git a/tests/eval.org b/tests/eval.org new file mode 100644 index 0000000..8218beb --- /dev/null +++ b/tests/eval.org @@ -0,0 +1,53 @@ +;;; Gash -- Guile As SHell +;;; Copyright © 2016, 2017, 2018 R.E.W. van Beusekom +;;; Copyright © 2018, 2019 Jan (janneke) Nieuwenhuizen +;;; Copyright © 2019 Timothy Sample +;;; +;;; This file is part of Gash. +;;; +;;; Gash is free software: you can redistribute it and/or modify +;;; it under the terms of the GNU General Public License as published by +;;; the Free Software Foundation, either version 3 of the License, or +;;; (at your option) any later version. +;;; +;;; Gash is distributed in the hope that it will be useful, +;;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;;; GNU General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with Gash. If not, see . + +* assignment-eval-echo +:script: +#+begin_src sh + foo=bar + baz=`eval echo ${foo}` + echo $baz +#+end_src +:stdout: +#+begin_example + bar +#+end_example + +* eval-echo-variable +:script: +#+begin_src sh + foo=baz + bar=foo + eval echo '$'$bar +#+end_src +:stdout: +#+begin_example + baz +#+end_example + +* eval +:script: +#+begin_src sh + eval echo 0 +#+end_src +:stdout: +#+begin_example + 0 +#+end_example diff --git a/tests/exiting.org b/tests/exiting.org new file mode 100644 index 0000000..884c903 --- /dev/null +++ b/tests/exiting.org @@ -0,0 +1,62 @@ +;;; Gash -- Guile As SHell +;;; Copyright © 2016, 2017, 2018 R.E.W. van Beusekom +;;; Copyright © 2018, 2019 Jan (janneke) Nieuwenhuizen +;;; Copyright © 2019 Timothy Sample +;;; +;;; This file is part of Gash. +;;; +;;; Gash is free software: you can redistribute it and/or modify +;;; it under the terms of the GNU General Public License as published by +;;; the Free Software Foundation, either version 3 of the License, or +;;; (at your option) any later version. +;;; +;;; Gash is distributed in the hope that it will be useful, +;;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;;; GNU General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with Gash. If not, see . + +* exit-0 +:script: +#+begin_src sh + exit 0 +#+end_src + +* exit-1 +:script: +#+begin_src sh + exit 1 +#+end_src +:status: 1 + +* exit-2 +:script: +#+begin_src sh + exit 2 +#+end_src +:status: 2 + +* exit-error +:script: +#+begin_src sh + set +e + ls /foo +#+end_src +:status: 2 + +* exit +:script: +#+begin_src sh + exit +#+end_src + +* exit-var +:script: +#+begin_src sh + set +e + ls /foo + exit $? +#+end_src +:status: 2 diff --git a/tests/exporting.org b/tests/exporting.org new file mode 100644 index 0000000..9aedd1f --- /dev/null +++ b/tests/exporting.org @@ -0,0 +1,73 @@ +;;; Gash -- Guile As SHell +;;; Copyright © 2016, 2017, 2018 R.E.W. van Beusekom +;;; Copyright © 2018, 2019 Jan (janneke) Nieuwenhuizen +;;; Copyright © 2019 Timothy Sample +;;; +;;; This file is part of Gash. +;;; +;;; Gash is free software: you can redistribute it and/or modify +;;; it under the terms of the GNU General Public License as published by +;;; the Free Software Foundation, either version 3 of the License, or +;;; (at your option) any later version. +;;; +;;; Gash is distributed in the hope that it will be useful, +;;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;;; GNU General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with Gash. If not, see . + +* export-new +:script: +#+begin_src sh + export V + + if [ -n "$V" ]; then + echo VEE + else + echo no VEE + fi +#+end_src +:stdout: +#+begin_example + no VEE +#+end_example + +* sh-export-new +:script: +#+begin_src sh + export V + + . tests/data/42-export-new.sh +#+end_src +:stdout: +#+begin_example + no VEE +#+end_example + +* sh-export +:script: +#+begin_src sh + bar=baz + export baz + sh tests/data/script.sh +#+end_src +:stdout: +#+begin_example + foo:bar + bar: +#+end_example + +* sh +:script: +#+begin_src sh + sh tests/data/script.sh + echo $foo +#+end_src +:stdout: +#+begin_example + foo:bar + bar: + +#+end_example diff --git a/tests/functions.org b/tests/functions.org new file mode 100644 index 0000000..4f0b0d1 --- /dev/null +++ b/tests/functions.org @@ -0,0 +1,74 @@ +;;; Gash -- Guile As SHell +;;; Copyright © 2016, 2017, 2018 R.E.W. van Beusekom +;;; Copyright © 2018, 2019 Jan (janneke) Nieuwenhuizen +;;; Copyright © 2019 Timothy Sample +;;; +;;; This file is part of Gash. +;;; +;;; Gash is free software: you can redistribute it and/or modify +;;; it under the terms of the GNU General Public License as published by +;;; the Free Software Foundation, either version 3 of the License, or +;;; (at your option) any later version. +;;; +;;; Gash is distributed in the hope that it will be useful, +;;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;;; GNU General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with Gash. If not, see . + +* function-at +:script: +#+begin_src sh + foo () { + echo $#:$@ + echo 0:$0 + echo 1:$1 + echo 2:$2 + } + + foo -v $@ +#+end_src +:args: ("-s" "--long" "file0" "file1") +:stdout: +#+begin_example + 5:-v -s --long file0 file1 + 0:test + 1:-v + 2:-s +#+end_example + +* function +:script: +#+begin_src sh + foo () { + echo $1 + } + + echo before + foo bar + foo baz + echo after +#+end_src +:stdout: +#+begin_example + before + bar + baz + after +#+end_example + +* subst +:script: +#+begin_src sh + subst () { + sed \ + -e s",foo,bar,"\ + $1 > $2 + } + + subst tests/data/foo $TEST_TMP/foo.tmp + cat $TEST_TMP/foo.tmp + rm $TEST_TMP/foo.tmp +#+end_src diff --git a/tests/loops.org b/tests/loops.org new file mode 100644 index 0000000..3bcca09 --- /dev/null +++ b/tests/loops.org @@ -0,0 +1,61 @@ +;;; Gash -- Guile As SHell +;;; Copyright © 2016, 2017, 2018 R.E.W. van Beusekom +;;; Copyright © 2018, 2019 Jan (janneke) Nieuwenhuizen +;;; Copyright © 2019 Timothy Sample +;;; +;;; This file is part of Gash. +;;; +;;; Gash is free software: you can redistribute it and/or modify +;;; it under the terms of the GNU General Public License as published by +;;; the Free Software Foundation, either version 3 of the License, or +;;; (at your option) any later version. +;;; +;;; Gash is distributed in the hope that it will be useful, +;;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;;; GNU General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with Gash. If not, see . + +* for-done-subshell +:script: +#+begin_src sh + (for i in 0; do echo $i; done) +#+end_src +:stdout: +#+begin_example + 0 +#+end_example + +* for +:script: +#+begin_src sh + for i in 0 1 2; do + echo $i; + done +#+end_src +:stdout: +#+begin_example + 0 + 1 + 2 +#+end_example + +* for-split-sequence +:script: +#+begin_src sh + one=1 + for i in 0 $one 2 $two_n_halve $two_n_quaaar and 3 ""; do + echo $i; + done +#+end_src +:stdout: +#+begin_example + 0 + 1 + 2 + and + 3 + +#+end_example diff --git a/tests/pipes-and-booleans.org b/tests/pipes-and-booleans.org new file mode 100644 index 0000000..c156edc --- /dev/null +++ b/tests/pipes-and-booleans.org @@ -0,0 +1,92 @@ +;;; Gash -- Guile As SHell +;;; Copyright © 2016, 2017, 2018 R.E.W. van Beusekom +;;; Copyright © 2018, 2019 Jan (janneke) Nieuwenhuizen +;;; Copyright © 2019 Timothy Sample +;;; +;;; This file is part of Gash. +;;; +;;; Gash is free software: you can redistribute it and/or modify +;;; it under the terms of the GNU General Public License as published by +;;; the Free Software Foundation, either version 3 of the License, or +;;; (at your option) any later version. +;;; +;;; Gash is distributed in the hope that it will be useful, +;;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;;; GNU General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with Gash. If not, see . + +* and +:script: +#+begin_src sh + true && exit 2 +#+end_src +:status: 2 + +* exec +:script: +#+begin_src sh + exec true + false +#+end_src + +* or +:script: +#+begin_src sh + false || true +#+end_src + +* pipe-exit-0 +:script: +#+begin_src sh + false | true +#+end_src + +* pipe-exit-1 +:script: +#+begin_src sh + true | false +#+end_src +:status: 1 + +* pipe-sed-cat +:script: +#+begin_src sh + echo -e 'a\nb\nc' tests/data/star/* | sed 's, ,\n,g' | cat +#+end_src +:stdout: +#+begin_example + a + b + c + tests/data/star/0 + tests/data/star/1 + tests/data/star/2 + tests/data/star/3 +#+end_example + +* pipe-sed +:script: +#+begin_src sh + echo -e 'a\nb\nc' tests/data/star/* | \sed 's, ,\n,g' +#+end_src +:stdout: +#+begin_example + a + b + c + tests/data/star/0 + tests/data/star/1 + tests/data/star/2 + tests/data/star/3 +#+end_example + +* semi +:script: +#+begin_src sh + # gash makes this into a pipeline, then uses `true''s exit status + false ; true +#+end_src +:status: 1 diff --git a/tests/redirects.org b/tests/redirects.org new file mode 100644 index 0000000..33634ed --- /dev/null +++ b/tests/redirects.org @@ -0,0 +1,153 @@ +;;; Gash -- Guile As SHell +;;; Copyright © 2016, 2017, 2018 R.E.W. van Beusekom +;;; Copyright © 2018, 2019 Jan (janneke) Nieuwenhuizen +;;; Copyright © 2019 Timothy Sample +;;; +;;; This file is part of Gash. +;;; +;;; Gash is free software: you can redistribute it and/or modify +;;; it under the terms of the GNU General Public License as published by +;;; the Free Software Foundation, either version 3 of the License, or +;;; (at your option) any later version. +;;; +;;; Gash is distributed in the hope that it will be useful, +;;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;;; GNU General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with Gash. If not, see . + +* iohere-builtin +:script: +#+begin_src sh + \cat < $TEST_TMP/bar + echo foo >> $TEST_TMP/bar + cat $TEST_TMP/bar + rm $TEST_TMP/bar +#+end_src +:stdout: +#+begin_example + foo + foo +#+end_example + +* redirect-clobber +:script: +#+begin_src sh + echo foo > /tmp/bar$$ + cat /tmp/bar$$ + > /tmp/bar$$ + cat /tmp/bar$$ +#+end_src +:stdout: +#+begin_example + foo +#+end_example + +* redirect-in-out +:script: +#+begin_src sh + cat < tests/data/foo > /tmp/bar$$ + cat /tmp/bar$$ + rm /tmp/bar$$ +#+end_src +:stdout: +#+begin_example + foo + bar + baz +#+end_example + +* redirect-in +:script: +#+begin_src sh + \cat < tests/data/foo +#+end_src + +;; * redirect-merge +;; :script: +;; #+begin_src sh +;; set +e +;; ls /bin/sh /bin/foo > bar 2>&1 +;; echo foo +;; cat bar +;; rm bar +;; #+end_src +;; :stdout: +;; #+begin_example +;; foo +;; ls: cannot access '/bin/foo': No such file or directory +;; /bin/sh +;; #+end_example + +* redirect-pipe +:script: +#+begin_src sh + echo foo | grep foo 2>/dev/null +#+end_src +:stdout: +#+begin_example + foo +#+end_example + +* redirect-sed +:script: +#+begin_src sh + unset DESTDIR + sed \ + -e "s,^#! /bin/sh,#! /bin/GASH," \ + tests/data/diff.scm > $DESTDIR/tmp/diff.scm + cat $DESTDIR/tmp/diff.scm + rm $DESTDIR/tmp/diff.scm +#+end_src +:stdout: +#+begin_example + #! /bin/GASH + !# + +#+end_example + +* redirect +:script: +#+begin_src sh + echo foo 1>/tmp/bar$$ + cat /tmp/bar$$ + rm /tmp/bar$$ +#+end_src +:stdout: +#+begin_example + foo +#+end_example + +* redirect-space +:script: +#+begin_src sh + echo foo > /tmp/bar$$ + cat /tmp/bar$$ + rm /tmp/bar$$ +#+end_src +:stdout: +#+begin_example + foo +#+end_example diff --git a/tests/run-test-suite.in b/tests/run-test-suite.in new file mode 100644 index 0000000..8d350cf --- /dev/null +++ b/tests/run-test-suite.in @@ -0,0 +1,253 @@ +#! @GUILE@ \ +--no-auto-compile -e main -s +!# + +;;; Gash -- Guile As SHell +;;; Copyright © 2019 Timothy Sample +;;; +;;; This file is part of Gash. +;;; +;;; Gash is free software: you can redistribute it and/or modify +;;; it under the terms of the GNU General Public License as published by +;;; the Free Software Foundation, either version 3 of the License, or +;;; (at your option) any later version. +;;; +;;; Gash is distributed in the hope that it will be useful, +;;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;;; GNU General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with Gash. If not, see . + +(use-modules (ice-9 match) + (ice-9 popen) + (ice-9 rdelim) + (ice-9 receive) + (ice-9 textual-ports) + (srfi srfi-9)) + + +;;; Test record + +(define-record-type + (%make-test name script args status stdout stderr xfail?) + test? + (name test-name) + (script test-script) + (args test-args) + (status test-status) + (stdout test-stdout) + (stderr test-stderr) + (xfail? test-xfail?)) + +(define* (make-test name script #:key (args '()) (status 0) + stdout stderr xfail?) + (unless (string? name) + (error (format #f "invalid test name: ~s" name))) + (unless (string? script) + (error (format #f "invalid test script: ~s" script))) + (match args + ((or () ((? string?) ...)) #t) + (_ (error (format #f "invalid test args: ~s" args)))) + (%make-test name script args status stdout stderr xfail?)) + + +;;; Org-style input + +(define (read-org-block ex-chr port) + (define block-name + (let ((name (read-delimited " \t\n" port 'peek))) + ;; Consume the rest of the line. + (read-line port) + (unless (string-prefix-ci? "begin_" name) + (error "Org blocks must start with \"begin_\"")) + (substring name 6))) + + (define delim + (string-append "#+end_" block-name "\n")) + + (let loop ((line (read-line port 'concat)) (acc '())) + (cond + ((eof-object? line) (error "end of file in Org block")) + ((string-ci=? line delim) (string-concatenate-reverse acc)) + (else + (unless (string-prefix? " " line) + (error "All Org block lines must indented with two spaces")) + (loop (read-line port 'concat) (cons (substring line 2) acc)))))) + +(read-hash-extend #\+ read-org-block) + +(define (read-tests port) + (let loop ((token (read port)) (test '()) (tests '())) + (match token + ((? eof-object?) + (reverse! (match test + (() tests) + (_ (cons test tests))))) + ('* + (let ((name (read-line port))) + (when (eof-object? name) + (error "end of file while expecting a value")) + (loop (read port) `((:name: . ,(string-trim name))) + (match test + (() tests) + (_ (cons test tests)))))) + (key + (let ((value (read port))) + (when (eof-object? value) + (error "end of file while expecting a value")) + (loop (read port) (acons key value test) tests)))))) + +(define (test-alist->test alist) + (make-test (assq-ref alist ':name:) + (assq-ref alist ':script:) + #:args (or (assq-ref alist ':args:) '()) + #:status (or (assq-ref alist ':status:) 0) + #:stdout (assq-ref alist ':stdout:) + #:stderr (assq-ref alist ':stderr:) + #:xfail? (assq-ref alist ':xfail?:))) + + +;;; Invocation helpers + +;; XXX: This is probably the slowest way possible to do this. I hope +;; it is correct, at least. +(define (get-strings-all . ports) + (define accs (make-hash-table (length ports))) + + (define (accs-cons! x port) + (hashq-set! accs port (cons x (hashq-ref accs port '())))) + + (let loop ((ps ports)) + (match ps + (() (map (lambda (port) + (reverse-list->string (hashq-ref accs port '()))) + ports)) + (_ (match (select ps '() '()) + (((ready-port . _) _ _) + (match (read-char ready-port) + ((? eof-object?) + (loop (filter (lambda (port) + (not (eq? port ready-port))) + ps))) + (chr (accs-cons! chr ready-port) + (loop ps))))))))) + +(define (observe shell script filename args) + "Use SHELL to interpret SCRIPT, returning the exit status, standard +output, and standard error as three values." + (match-let (((stdout-input . stdout-output) (pipe)) + ((stderr-input . stderr-output) (pipe)) + ((ex-input . ex-output) (pipe))) + (match (primitive-fork) + (0 (catch #t + (lambda () + (close-port stdout-input) + (close-port stderr-input) + (close-port ex-input) + (dup stdout-output 1) + (dup stderr-output 2) + (setenv "TEST_TMP" (getcwd)) + (chdir "@abs_top_srcdir@") + (apply execlp shell shell "-e" "-c" script filename args)) + (lambda args + (write args ex-output) + (force-output ex-output) + (primitive-_exit EXIT_FAILURE)))) + (pid (close-port stdout-output) + (close-port stderr-output) + (close-port ex-output) + (match (get-strings-all stdout-input stderr-input ex-input) + ((stdout stderr "") + (match-let (((pid . status) (waitpid pid))) + (values (status:exit-val status) stdout stderr))) + ((_ _ ex) + (apply throw (call-with-input-string ex read)))))))) + + +;;; Runner + +(define (display-output output) + (format #t "---~%~a~a---~%" + output (if (string-suffix? "\n" output) "" "\n"))) + +(define (run-test test shell) + (match-let ((($ name script args + xstatus xstdout xstderr xfail?) test)) + (format #t "Start test: ~a~%" name) + (display "Script: ") + (display-output script) + (format #t "Arguments: ~s~%" args) + (catch #t + (lambda () + (receive (status stdout stderr) (observe shell script "test" args) + (let* ((status-ok? (= status xstatus)) + (stdout-ok? (or (not xstdout) (string=? stdout xstdout))) + (stderr-ok? (or (not xstderr) (string=? stderr xstderr))) + (ok? (and status-ok? stdout-ok? stderr-ok?)) + (result (if ok? + (if xfail? 'xpass 'pass) + (if xfail? 'xfail 'fail)))) + (unless status-ok? + (format #t "Expected status: ~a~%" xstatus) + (format #t "Actual status: ~a~%" status)) + (unless stdout-ok? + (display "Expected stdout: ") + (display-output xstdout) + (display "Actual stdout: " ) + (display-output stdout)) + (unless stderr-ok? + (display "Expected stderr: ") + (display-output xstderr) + (display "Actual stderr: " ) + (display-output stderr)) + (format #t "Result: ~a~%" result) + (format #t "End test: ~a~%" name) + result))) + (lambda args + (format #t "Test error: ~s~%" args) + (format #t "End test: ~a~%" name) + 'error)))) + +(define (run-tests tests shell) + (let loop ((tests tests) (pass 0) (fail 0) (xpass 0) (xfail 0) (error 0)) + (match tests + (() + (format #t "== Summary ==~%") + (for-each (match-lambda + ((label . count) + (when (> count 0) + (format #t "~a~a~%" label count)))) + `(("Expected passes: " . ,pass) + ("Expected failures: " . ,xfail) + ("Unexpected passes: " . ,xpass) + ("Unexpected failures: " . ,fail) + ("Errors: " . ,error))) + (let ((pass? (and (= xpass 0) (= fail 0) (= error 0)))) + (format #t "Result: ~a~%" (if pass? "pass" "fail")) + pass?)) + ((test . rest) + (match (let ((result (run-test test shell))) + (newline) + result) + ('pass (loop rest (1+ pass) fail xpass xfail error)) + ('fail (loop rest pass (1+ fail) xpass xfail error)) + ('xpass (loop rest pass fail (1+ xpass) xfail error)) + ('xfail (loop rest pass fail xpass (1+ xfail) error)) + ('error (loop rest pass fail xpass xfail (1+ error)))))))) + + +;;; Main + +(define (main args) + (match args + ((_ filename) + (exit (run-tests (map test-alist->test + (call-with-input-file filename read-tests)) + "gash"))) + (_ (error "invalid arguments")))) + +;;; Local Variables: +;;; mode: scheme +;;; End: diff --git a/tests/signals.org b/tests/signals.org new file mode 100644 index 0000000..c37ac90 --- /dev/null +++ b/tests/signals.org @@ -0,0 +1,34 @@ +;;; Gash -- Guile As SHell +;;; Copyright © 2016, 2017, 2018 R.E.W. van Beusekom +;;; Copyright © 2018, 2019 Jan (janneke) Nieuwenhuizen +;;; Copyright © 2019 Timothy Sample +;;; +;;; This file is part of Gash. +;;; +;;; Gash is free software: you can redistribute it and/or modify +;;; it under the terms of the GNU General Public License as published by +;;; the Free Software Foundation, either version 3 of the License, or +;;; (at your option) any later version. +;;; +;;; Gash is distributed in the hope that it will be useful, +;;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;;; GNU General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with Gash. If not, see . + +* trap-subshell +:script: +#+begin_src sh + trap "rm /tmp/bar$$" 0 + echo foo > /tmp/bar$$ + cat /tmp/bar$$ + (exit 0) + cat /tmp/bar$$ +#+end_src +:stdout: +#+begin_example + foo + foo +#+end_example diff --git a/tests/variable-and.org b/tests/variable-and.org new file mode 100644 index 0000000..0e067e2 --- /dev/null +++ b/tests/variable-and.org @@ -0,0 +1,40 @@ +;;; Gash -- Guile As SHell +;;; Copyright © 2016, 2017, 2018 R.E.W. van Beusekom +;;; Copyright © 2018, 2019 Jan (janneke) Nieuwenhuizen +;;; Copyright © 2019 Timothy Sample +;;; +;;; This file is part of Gash. +;;; +;;; Gash is free software: you can redistribute it and/or modify +;;; it under the terms of the GNU General Public License as published by +;;; the Free Software Foundation, either version 3 of the License, or +;;; (at your option) any later version. +;;; +;;; Gash is distributed in the hope that it will be useful, +;;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;;; GNU General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with Gash. If not, see . + +* variable-and +:script: +#+begin_src sh + foo=baz + echo ${foo+bar} +#+end_src +:stdout: +#+begin_example + bar +#+end_example + +* variable-not-and +:script: +#+begin_src sh + echo ${foo+bar} +#+end_src +:stdout: +#+begin_example + +#+end_example diff --git a/tests/variable-or.org b/tests/variable-or.org new file mode 100644 index 0000000..58eeb85 --- /dev/null +++ b/tests/variable-or.org @@ -0,0 +1,80 @@ +;;; Gash -- Guile As SHell +;;; Copyright © 2016, 2017, 2018 R.E.W. van Beusekom +;;; Copyright © 2018, 2019 Jan (janneke) Nieuwenhuizen +;;; Copyright © 2019 Timothy Sample +;;; +;;; This file is part of Gash. +;;; +;;; Gash is free software: you can redistribute it and/or modify +;;; it under the terms of the GNU General Public License as published by +;;; the Free Software Foundation, either version 3 of the License, or +;;; (at your option) any later version. +;;; +;;; Gash is distributed in the hope that it will be useful, +;;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;;; GNU General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with Gash. If not, see . + +* variable-not-or +:script: +#+begin_src sh + foo=baz + echo ${foo-bar} +#+end_src +:stdout: +#+begin_example + baz +#+end_example + +* variable-or-doublequote +:script: +#+begin_src sh + CPPFLAGS=${CPPFLAGS-" + -I ${srcdest}src + "} + echo $CPPFLAGS +#+end_src +:stdout: +#+begin_example + -I src +#+end_example + +* variable-or-empty +:script: +#+begin_src sh + echo ${bindir-} +#+end_src +:stdout: +#+begin_example + +#+end_example + +* variable-or +:script: +#+begin_src sh + echo ${foo-bar} +#+end_src +:stdout: +#+begin_example + bar +#+end_example + +* variable-or-slash +:script: +#+begin_src sh + echo ${foo-bar/} +#+end_src + +* variable-or-variable +:script: +#+begin_src sh + prefix=/usr + echo ${bindir-$prefix/bin} +#+end_src +:stdout: +#+begin_example + /usr/bin +#+end_example diff --git a/tests/variable-patterns.org b/tests/variable-patterns.org new file mode 100644 index 0000000..11f8d38 --- /dev/null +++ b/tests/variable-patterns.org @@ -0,0 +1,103 @@ +;;; Gash -- Guile As SHell +;;; Copyright © 2016, 2017, 2018 R.E.W. van Beusekom +;;; Copyright © 2018, 2019 Jan (janneke) Nieuwenhuizen +;;; Copyright © 2019 Timothy Sample +;;; +;;; This file is part of Gash. +;;; +;;; Gash is free software: you can redistribute it and/or modify +;;; it under the terms of the GNU General Public License as published by +;;; the Free Software Foundation, either version 3 of the License, or +;;; (at your option) any later version. +;;; +;;; Gash is distributed in the hope that it will be useful, +;;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;;; GNU General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with Gash. If not, see . + +* hash-hash +:script: +#+begin_src sh + file=dir/sub/name.ext + echo ${file##*/} +#+end_src +:stdout: +#+begin_example + name.ext +#+end_example + +* hash +:script: +#+begin_src sh + file=dir/sub/name.ext + echo ${file#*/} +#+end_src +:stdout: +#+begin_example + sub/name.ext +#+end_example + +* percent-percent +:script: +#+begin_src sh + file=dir/sub/name.ext + echo ${file%%/*} +#+end_src +:stdout: +#+begin_example + dir +#+end_example + +* percent +:script: +#+begin_src sh + file=dir/sub/name.ext + echo ${file%/*} +#+end_src +:stdout: +#+begin_example + dir/sub +#+end_example + +* percent-space +:script: +#+begin_src sh + args="--prefix=/usr " + echo ${args% *}/ +#+end_src +:stdout: +#+begin_example + --prefix=/usr/ +#+end_example + +* slash +:script: +#+begin_src sh + var='xxfooxx' + echo "${var/foo}" +#+end_src +:stdout: +#+begin_example + xxxx +#+end_example + +* slash-string +:script: +#+begin_src sh + var='xxfooxx' + echo "${var/foo/bar}" +#+end_src +:stdout: +#+begin_example + xxbarxx +#+end_example + +* slash-string-slash +:script: +#+begin_src sh + var='xxfooxx' + echo "${var/foo/bar/}" +#+end_src diff --git a/tests/variable-words.org b/tests/variable-words.org new file mode 100644 index 0000000..d9b9bc3 --- /dev/null +++ b/tests/variable-words.org @@ -0,0 +1,57 @@ +;;; Gash -- Guile As SHell +;;; Copyright © 2016, 2017, 2018 R.E.W. van Beusekom +;;; Copyright © 2018, 2019 Jan (janneke) Nieuwenhuizen +;;; Copyright © 2019 Timothy Sample +;;; +;;; This file is part of Gash. +;;; +;;; Gash is free software: you can redistribute it and/or modify +;;; it under the terms of the GNU General Public License as published by +;;; the Free Software Foundation, either version 3 of the License, or +;;; (at your option) any later version. +;;; +;;; Gash is distributed in the hope that it will be useful, +;;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;;; GNU General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with Gash. If not, see . + +* echo-equal +:script: +#+begin_src sh + echo a=$a +#+end_src +:stdout: +#+begin_example + a= +#+end_example + +* echo-var +:script: +#+begin_src sh + echo $SHELL +#+end_src + +* echo-word-at +:script: +#+begin_src sh + echo command $@ +#+end_src +:args: ("-s" "--long" "file0" "file1") +:stdout: +#+begin_example + command -s --long file0 file1 +#+end_example + +* echo-word-at-word +:script: +#+begin_src sh + echo command $@ plus +#+end_src +:args: ("-s" "--long" "file0" "file1") +:stdout: +#+begin_example + command -s --long file0 file1 plus +#+end_example diff --git a/tests/words.org b/tests/words.org new file mode 100644 index 0000000..f28ed62 --- /dev/null +++ b/tests/words.org @@ -0,0 +1,75 @@ +;;; Gash -- Guile As SHell +;;; Copyright © 2016, 2017, 2018 R.E.W. van Beusekom +;;; Copyright © 2018, 2019 Jan (janneke) Nieuwenhuizen +;;; Copyright © 2019 Timothy Sample +;;; +;;; This file is part of Gash. +;;; +;;; Gash is free software: you can redistribute it and/or modify +;;; it under the terms of the GNU General Public License as published by +;;; the Free Software Foundation, either version 3 of the License, or +;;; (at your option) any later version. +;;; +;;; Gash is distributed in the hope that it will be useful, +;;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;;; GNU General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with Gash. If not, see . + +* echo-brace +:script: +#+begin_src sh + echo foo:{bar} +#+end_src +:stdout: +#+begin_example + foo:{bar} +#+end_example + +* echo-doublequotes +:script: +#+begin_src sh + echo "foo" b"ar" +#+end_src +:stdout: +#+begin_example + foo bar +#+end_example + +* echo-escaped-doublequotes +:script: +#+begin_src sh + echo foo "bar" \"baz\" +#+end_src +:stdout: +#+begin_example + foo bar "baz" +#+end_example + +* echo-nesting +:script: +#+begin_src sh + echo 'foo "bar"' +#+end_src +:stdout: +#+begin_example + foo "bar" +#+end_example + +* echo-quoted-doublequotes +:script: +#+begin_src sh + echo foo "bar" '"baz"' +#+end_src +:stdout: +#+begin_example + foo bar "baz" +#+end_example + +* echo +:script: +#+begin_src sh + echo +#+end_src