Add integration tests
Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
This commit is contained in:
28
runtests.sh
Executable file
28
runtests.sh
Executable 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"
|
||||
Reference in New Issue
Block a user