10 test -t 1 && colorize=1
12 test -n "$colorize" &&
17 comm --nocheck-order --output-delimiter=::: -3 $@ |
18 perl -pe"END{exit !!\$.} s/^:::/$(color 31)>/ || s/^/$(color 32)</"
24 -G) regenerate=1 && shift;;
25 -*) echo "Usage: $0 [-G] [<files>...]"; exit 64;;
29 for candidate in ${@:-t*.out}
31 test_count=$((test_count+1))
32 file="${candidate%.out}"
33 input="${file%%_-*}.in"
34 name="$(echo ${file#*-} | tr _ \ )"
37 [ -r "$input" ] && set -- "$@" "$input"
38 case "$name" in *\ -*) set -- "$@" -"${name#* -}";; esac
40 *' ?' ) set -- sh -c "\$0 \$@ 2>/dev/null" "$@";;
41 *' ?'*) set -- sh -c "\$0 \$@ | test \$\? = ${name#* \?}" "$@";;
42 *' |'*) set -- sh -c "\$0 \$@ | ${name#* |}" "$@";;
46 if test -n "$regenerate"
50 echo "ok $test_count # skip $file.out"
54 elif test -e "$file.out"
56 "$@" 2>&1 | diffcmd "$file.out" -
59 echo "not ok $test_count - $name # TODO"
66 fail_count=$((fail_count+1))
70 echo "ok $test_count - $name"
74 if test $fail_count = 0
77 echo "# passed all $test_count test(s)"
80 echo "# failed $fail_count among $test_count test(s)"
81 fail_count=1 # exit code