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;;
31 echo "1..$(echo $params | wc -w)"
34 for candidate in $params
36 test_count=$((test_count+1))
37 file="${candidate%.out}"
38 input="${file%%_-*}.in"
39 name="$(echo ${file#*-} | tr _ \ )"
42 [ -r "$input" ] && set -- "$@" "$input"
46 set -- "$@" -"${args% [?|]*}"
50 *' ?' ) set -- sh -c "\$0 \$@ 2>/dev/null" "$@";;
51 *' ?'*) set -- sh -c "\$0 \$@ | test \$\? = ${name#* \?}" "$@";;
52 *' |'*) set -- sh -c "\$0 \$@ | ${name#* |}" "$@";;
53 *) eval set -- "$1" $2 $3
56 if test -n "$regenerate"
60 echo "ok $test_count # skip $file.out"
64 elif test -e "$file.out"
66 "$@" 2>&1 | diffcmd "$file.out" -
69 echo "not ok $test_count - $name # TODO"
81 fail_count=$((fail_count+1))
87 echo "ok $test_count - $name"
91 if test $fail_count = 0
94 echo "# passed all $test_count test(s)"
97 echo "# failed $fail_count among $test_count test(s)"
98 fail_count=1 # exit code