Skip to content

Commit

Permalink
[test/gold] Port tests from spec/ dir
Browse files Browse the repository at this point in the history
Found a bug in big-here-doc!  That's #1089.
  • Loading branch information
Andy C committed Feb 10, 2022
1 parent 7bd12cc commit 2155e05
Show file tree
Hide file tree
Showing 9 changed files with 22 additions and 35 deletions.
1 change: 1 addition & 0 deletions soil/worker.sh
Expand Up @@ -202,6 +202,7 @@ all-markdown build/doc.sh all-markdown -
syscall-by-code test/syscall.sh by-code _tmp/syscall/by-code.txt
syscall-by-input test/syscall.sh by-input _tmp/syscall/by-input.txt
osh-spec test/spec.sh soil-run-osh _tmp/spec/survey/osh.html
gold test/gold.sh all-passing -
make-tarball devtools/release.sh quick-oil-tarball _release/oil.tar
test-tarball build/test.sh oil-tar -
EOF
Expand Down
4 changes: 0 additions & 4 deletions spec/08-dollar0.sh

This file was deleted.

30 changes: 0 additions & 30 deletions spec/11-brace-redirect.sh

This file was deleted.

17 changes: 16 additions & 1 deletion test/gold.sh
Expand Up @@ -30,11 +30,13 @@ _compare() {
"$@" >_tmp/shebang.txt
local expected_status=$?

PATH="$PWD/bin:$PATH" $OSH "$@" >_tmp/osh.txt
$OSH "$@" >_tmp/osh.txt
local osh_status=$?

set -o errexit

#md5sum _tmp/shebang.txt _tmp/osh.txt

if ! diff -u _tmp/shebang.txt _tmp/osh.txt; then
echo FAIL
exit 1
Expand Down Expand Up @@ -102,7 +104,12 @@ export-case() { _compare $GOLD_DIR/export.sh; }
glob() { _compare $GOLD_DIR/glob.sh; }
no-op() { _compare metrics/source-code.sh; }
complex-here-docs() { _compare $GOLD_DIR/complex-here-docs.sh; }
big-here-doc() { _compare $GOLD_DIR/big-here-doc.sh; }
case-in-subshell() { _compare $GOLD_DIR/case-in-subshell.sh; }
command-sub() { _compare $GOLD_DIR/command-sub.sh; }
command-sub-2() { _compare $GOLD_DIR/command-sub-2.sh; }

char-class() { _compare $GOLD_DIR/char-class.sh demo; }
strip-op-char-class() { _compare $GOLD_DIR/strip-op-char-class.sh; }

# Similar tests for backslash escaping.
Expand Down Expand Up @@ -164,10 +171,18 @@ readonly -a PASSING=(
no-op
complex-here-docs

# BUG IN OSH!
# big-here-doc

case-in-subshell
command-sub
command-sub-2

echo-e
dollar-sq
word-eval

char-class
strip-op-char-class
abuild

Expand Down
File renamed without changes.
File renamed without changes.
5 changes: 5 additions & 0 deletions spec/01-char-class.sh → test/gold/char-class.sh
Expand Up @@ -21,6 +21,11 @@ demo() {
# NOTE: there is only one negation. You can't mix them.
[[ 0 == [^[:alpha:]] ]]

if test -n "${BASH_VERSION:-}"; then
#echo hi
true
fi

echo
echo 'ALL PASSED'
}
Expand Down
File renamed without changes.
File renamed without changes.

0 comments on commit 2155e05

Please sign in to comment.