Advertisement
brandizzi

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

Aug 2nd, 2018
346
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.58 KB | None | 0 0
  1. #!/usr/bin/env bash
  2. for l in examples/*.lox
  3. do
  4.     out=$(mktemp)
  5.     err=$(mktemp)
  6.     if [ -e $l.skip ]
  7.     then
  8.        echo SKIP $l
  9.        continue
  10.     elif [ ! -e $l.out ] || [ ! -e $l.err ]
  11.     then
  12.        echo missing $l.out or $l.err
  13.        exit 1
  14.     fi
  15.     java -classpath target/classes/ br.com.brandizzi.adam.myjlox.Lox $l > $out 2> $err
  16.     FAIL=0
  17.     if ! diff $l.out $out
  18.     then
  19.        FAIL=1
  20.     fi
  21.     if ! diff $l.err $err
  22.     then
  23.        FAIL=1
  24.     fi
  25.     if [ "$FAIL" = "1" ]
  26.     then
  27.        echo FAIL $l
  28.     else
  29.        echo PASS $l
  30.     fi
  31. done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement