diff options
| author | Randy Palamar <randy@rnpnr.xyz> | 2024-05-21 19:53:22 -0600 |
|---|---|---|
| committer | Randy Palamar <randy@rnpnr.xyz> | 2024-05-21 19:53:22 -0600 |
| commit | b7074021b7bfb0932b889b9560dd22df31cef818 (patch) | |
| tree | 0295b18de8fb8ea5289cbda95675687ae06025ff /test/lua/test.sh | |
| parent | b7f8018a00be930e3f2b864949aec1f91291309c (diff) | |
| parent | efafa3c178268a4149fc3e432bc1174a013c16de (diff) | |
| download | vis-b7074021b7bfb0932b889b9560dd22df31cef818.tar.gz vis-b7074021b7bfb0932b889b9560dd22df31cef818.tar.xz | |
Merge vis-tests into test directory
Going forward all tests should be submitted here directly.
Diffstat (limited to 'test/lua/test.sh')
| -rwxr-xr-x | test/lua/test.sh | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/test/lua/test.sh b/test/lua/test.sh new file mode 100755 index 0000000..4d885de --- /dev/null +++ b/test/lua/test.sh @@ -0,0 +1,45 @@ +#!/bin/sh + +export VIS_PATH=. +[ -z "$VIS" ] && VIS="../../vis" +$VIS -v + +if ! $VIS -v | grep '+lua' >/dev/null 2>&1; then + echo "vis compiled without lua support, skipping tests" + exit 0 +fi + +type busted >/dev/null 2>&1 || { + echo "busted(1) not found, skipping tests" + exit 0 +} + +TESTS_OK=0 +TESTS_RUN=0 + +if [ $# -gt 0 ]; then + test_files=$* +else + test_files="$(find . -type f -name '*.lua' -a ! -name visrc.lua)" +fi + +for t in $test_files; do + TESTS_RUN=$((TESTS_RUN + 1)) + t=${t%.lua} + t=${t#./} + printf "%-30s" "$t" + $VIS "$t.in" < /dev/null 2> /dev/null > "$t.busted" + + if [ $? -ne 0 ]; then + printf "FAIL\n" + cat "$t.busted" + else + TESTS_OK=$((TESTS_OK + 1)) + printf "OK\n" + fi +done + +printf "Tests ok %d/%d\n" $TESTS_OK $TESTS_RUN + +# set exit status +[ $TESTS_OK -eq $TESTS_RUN ] |
