brandizzi icon

lcheck.sh: a script to ensure the behavior of my Lox program

brandizzi | PRO | 08/02/18 11:11:29 AM UTC | 0 ⭐ | 648 👁️ | Never ⏰ | []
Bash |

580 B

|

None

|

0 👍

/

0 👎

#!/usr/bin/env bash
for l in examples/*.lox
do
    out=$(mktemp)
    err=$(mktemp)
    if [ -e $l.skip ]
    then
       echo SKIP $l
       continue
    elif [ ! -e $l.out ] || [ ! -e $l.err ]
    then
       echo missing $l.out or $l.err
       exit 1
    fi
    java -classpath target/classes/ br.com.brandizzi.adam.myjlox.Lox $l > $out 2> $err
    FAIL=0
    if ! diff $l.out $out
    then
       FAIL=1
    fi
    if ! diff $l.err $err
    then
       FAIL=1
    fi
    if [ "$FAIL" = "1" ]
    then
       echo FAIL $l
    else
       echo PASS $l
    fi
done

Comments