099b944632d4166f22891e1bdc55fec56a727907
[barcat.git] / t / regress.t
1 #!/bin/sh
2
3 cd "${0%/*}" || exit 1
4
5 test_count=0
6
7 COLUMNS=40
8 diffcmd='diff --unchanged-line-format= --old-line-format=<%L --new-line-format=>%L'
9
10 for option in "$@"
11 do
12         case "$option" in
13         -*) echo "Usage: $0 [<files>...]"; exit 64;;
14         esac
15 done
16
17 for candidate in ${@:-t*.in}
18 do
19         test_count=$((test_count+1))
20         file="${candidate%.in}"
21         test -r "$file.in" || continue
22
23         name="$(echo ${file#*-} | tr _ \ )"
24         cmd="barcat $file.in"
25         case "$name" in *\ -*) cmd="$cmd -${name#* -}";; esac
26
27         $cmd 2>&1 | $diffcmd "$file.out" - || printf 'not '
28         echo "ok $test_count - $name"
29 done
30
31 echo "1..$test_count"