diff options
| -rw-r--r-- | sam/commands/filter-capitalize.cmd | 2 | ||||
| -rwxr-xr-x | sam/test.sh | 41 |
2 files changed, 27 insertions, 16 deletions
diff --git a/sam/commands/filter-capitalize.cmd b/sam/commands/filter-capitalize.cmd index ca9d989..78ef691 100644 --- a/sam/commands/filter-capitalize.cmd +++ b/sam/commands/filter-capitalize.cmd @@ -1 +1 @@ -,x/[a-zA-Z]+/ | tr a-z A-Z
\ No newline at end of file +,x/[a-zA-Z]+/ | tr a-z A-Z diff --git a/sam/test.sh b/sam/test.sh index 8864d9c..0a50879 100755 --- a/sam/test.sh +++ b/sam/test.sh @@ -2,21 +2,26 @@ NL=' ' -PLAN9="/usr/local/plan9/bin" [ -z "$VIS" ] && VIS="../../vis" +[ -z "$SAM" ] && SAM="sam" +[ -z "$PLAN9" ] && PLAN9="/usr/local/plan9/bin" -if [ -z "$SSAM" ] || ! type "$SSAM" >/dev/null 2>&1; then - SSAM="$PLAN9/ssam" - if ! type "$SSAM" >/dev/null 2>&1; then - if type 9 >/dev/null 2>&1; then - SSAM="9 ssam" - else - echo "ssam(1) not found, skipping tests" - exit 0 - fi +for SAM in "$SAM" "$PLAN9/sam" /usr/lib/plan9/bin/sam 9; do + if type "$SAM" >/dev/null 2>&1; then + break fi -fi +done + +type "$SAM" >/dev/null 2>&1 || { + echo "sam(1) not found, skipping tests" + exit 0 +} + +[ "$SAM" = "9" ] && SAM="9 sam" + +echo "$SAM" +$VIS -v TESTS=$1 [ -z "$TESTS" ] && TESTS=$(find . -name '*.cmd' | sed 's/\.cmd$//g') @@ -24,9 +29,6 @@ TESTS=$1 TESTS_RUN=0 TESTS_OK=0 -echo "$SSAM" -$VIS -v - for t in $TESTS; do IN="$t.in" CMD="$(cat $t.cmd)" @@ -37,7 +39,16 @@ for t in $TESTS; do REF="$t.ref" rm -f "$SAM_OUT" "$SAM_ERR" "$VIS_OUT" "$VIS_ERR" printf "Running test %s with sam ... " "$t" - cat "$IN" | PATH="$PLAN9:$PATH" $SSAM "$CMD" > "$SAM_OUT" + + { + echo ',{' + echo k + echo '}' + echo 0k + cat "$t.cmd" + echo , + } | $SAM -d "$IN" > "$SAM_OUT" 2>/dev/null + if [ $? -ne 0 ]; then printf "ERROR\n" elif [ -e "$REF" ]; then |
