#!/bin/bash function die() { local msg msg="$1" echo "$msg - exiting" exit 1 } here="$(realpath "$(dirname "$0")")" tests="$here/tests" flags="--quiet --release" echo "building" cargo build $flags || die "build failed" echo "testing" find "$tests" -type f -name '*.npp' | while read f; do result="$(cargo run $flags -- "$f")" echo "$result" > "$f.got" if [[ "$result" != "$(cat "$f.expect")" ]]; then echo "$f did not match expected output" diff "$f.got" "$f.expect" fi done echo "done"