annotate tests/test-parse-errors/test-parse-errors.sh @ 228:56ff594b022c

Add tests for parse errors in invalid transform files
author Chris Cannam
date Thu, 25 Feb 2016 12:04:10 +0000
parents
children
rev   line source
Chris@228 1 #!/bin/bash
Chris@228 2
Chris@228 3 . ../include.sh
Chris@228 4
Chris@228 5 infile=$audiopath/3clicks8.wav
Chris@228 6 tmpfile=$mypath/tmp_$$
Chris@228 7 trap "rm -f $tmpfile" 0
Chris@228 8
Chris@228 9 for transform in "$mypath"/inputs/* ; do
Chris@228 10
Chris@228 11 base=$(basename "$transform")
Chris@228 12 expected="$mypath"/expected/"$base".txt
Chris@228 13
Chris@228 14 if [ ! -f "$expected" ]; then
Chris@228 15 fail "Internal error: Expected file $expected not found for transform $transform"
Chris@228 16 fi
Chris@228 17
Chris@228 18 if $r -t "$transform" -w csv --csv-one-file /dev/null "$infile" 2>"$tmpfile" ; then
Chris@228 19 fail "Erroneously succeeds in running bogus transform $transform"
Chris@228 20 fi
Chris@228 21
Chris@228 22 cat "$expected" | while read line; do
Chris@228 23 if ! fgrep -q "$line" "$tmpfile" ; then
Chris@228 24 fail "Expected output text \"$line\" not found in diagnostic output for transform $base"
Chris@228 25 fi
Chris@228 26 done
Chris@228 27
Chris@228 28 done
Chris@228 29