diff options
Diffstat (limited to 'test/test-runner.bash')
-rw-r--r-- | test/test-runner.bash | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/test/test-runner.bash b/test/test-runner.bash new file mode 100644 index 0000000..8360308 --- /dev/null +++ b/test/test-runner.bash @@ -0,0 +1,35 @@ +# shellcheck disable=2001,2154,2207 + +set -e -u -o pipefail + +run-tests() ( + root=$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd) + + cd "$root" + + if [[ $# -gt 0 ]]; then + ids=("$@") + else + ids=($(cd data; printf "%s\n" * | grep '[0-9]')) + fi + + count=0 + for id in "${ids[@]}"; do + check-test "$id" || continue + + dir=data/$id + label="$id: $(< "$dir/===")" + [[ -e $dir/in.yaml ]] || continue + + run-test "$dir" + + if $ok; then + echo "ok $((++count)) $label" + else + echo "not ok $((++count)) $label" + echo "$output" | sed 's/^/# /' + fi + done + + echo "1..$count" +) |