Files
not-python-rust/runtests.sh
Alek Ratzloff c176efb13a Add some tests for modules
* .gitignore now ignores *.got for *anything* under the tests/ directory
* runtests.sh ignores files in the tests/ directory that have the string
  "test_import_" in them, so they are not run as tests themselves
* Add a couple of basic module functionality tests

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2024-10-04 11:11:46 -07:00

32 lines
637 B
Bash
Executable File

#!/bin/bash
function die() {
local msg
msg="$1"
echo "$msg - exiting"
exit 1
}
here="$(realpath "$(dirname "$0")")"
tests="$here/tests"
flags="--quiet --release"
# Disable warnings while running tests
export RUSTFLAGS=-Awarnings
echo "building"
cargo build $flags || die "build failed"
echo "testing"
find "$tests" -type f -name '*.npp' -not -name "*test_import_*" | 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"