2024-09-25 11:42:51 -07:00
|
|
|
#!/bin/bash
|
|
|
|
|
function die() {
|
|
|
|
|
local msg
|
|
|
|
|
msg="$1"
|
|
|
|
|
echo "$msg - exiting"
|
|
|
|
|
exit 1
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
here="$(realpath "$(dirname "$0")")"
|
|
|
|
|
tests="$here/tests"
|
|
|
|
|
flags="--quiet --release"
|
|
|
|
|
|
2024-09-30 16:32:52 -07:00
|
|
|
# Disable warnings while running tests
|
|
|
|
|
export RUSTFLAGS=-Awarnings
|
|
|
|
|
|
2024-09-25 11:42:51 -07:00
|
|
|
echo "building"
|
|
|
|
|
cargo build $flags || die "build failed"
|
|
|
|
|
|
|
|
|
|
echo "testing"
|
2024-10-04 11:11:46 -07:00
|
|
|
find "$tests" -type f -name '*.npp' -not -name "*test_import_*" | while read f; do
|
2024-09-25 11:42:51 -07:00
|
|
|
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"
|