diff options
author | Laria Carolin Chabowski <laria@laria.me> | 2020-05-01 15:15:12 +0200 |
---|---|---|
committer | Laria Carolin Chabowski <laria@laria.me> | 2020-05-01 15:15:12 +0200 |
commit | dc5dab268c5a39f4df5159b62d24a24a6e9fa988 (patch) | |
tree | 51b031888523e0df078988e16b55758be4b9cf0a /tests/run_tests.sh | |
parent | 2381c52c690342f773a7cfa500387b6bfad76952 (diff) | |
download | ste-dc5dab268c5a39f4df5159b62d24a24a6e9fa988.tar.gz ste-dc5dab268c5a39f4df5159b62d24a24a6e9fa988.tar.bz2 ste-dc5dab268c5a39f4df5159b62d24a24a6e9fa988.zip |
tests: Make it easier to run a single test
Diffstat (limited to 'tests/run_tests.sh')
-rwxr-xr-x | tests/run_tests.sh | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/tests/run_tests.sh b/tests/run_tests.sh new file mode 100755 index 0000000..4e46977 --- /dev/null +++ b/tests/run_tests.sh @@ -0,0 +1,42 @@ +#!/bin/sh + +set -e + +run() { + ( # So we don't have to cd .. + cd "$1" || return 1 + + php ../test.php > have + + printf '\e[1m%s\e[0m: ' "$1" + if sed 's/\s*//' < have | grep -v '^$' | cmp -s want; then + echo "OK" + rm ./*.transc.php + else + echo "FAILED" + for tpl in *.tpl; do + php ../dump_ast.php < "$tpl" > "$tpl.ast" + done + return 1 + fi + ) +} + +run_many() { + retval=0 + while [ $# -gt 0 ]; do + if ! run "$1"; then + retval=1 + fi + + shift + done + + return $retval +} + +if [ $# -eq 0 ]; then + run_many test_* +else + run_many "$@" +fi |