Add integration tests

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
This commit is contained in:
2024-09-25 11:42:51 -07:00
parent 38a2064b08
commit f020155453
6 changed files with 271 additions and 0 deletions

28
runtests.sh Executable file
View File

@@ -0,0 +1,28 @@
#!/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"