# HG changeset patch # User Chris Cannam # Date 1456401850 0 # Node ID 56ff594b022ca41e9ab3cb9d9997c10a3fee0d76 # Parent 88044af67bd1cfe3b526462c1c7d5dced163fc67 Add tests for parse errors in invalid transform files diff -r 88044af67bd1 -r 56ff594b022c tests/test-parse-errors/expected/empty.ttl.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/test-parse-errors/expected/empty.ttl.txt Thu Feb 25 12:04:10 2016 +0000 @@ -0,0 +1,1 @@ +RDF parser reported: Failed to import model from URL diff -r 88044af67bd1 -r 56ff594b022c tests/test-parse-errors/expected/empty.xml.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/test-parse-errors/expected/empty.xml.txt Thu Feb 25 12:04:10 2016 +0000 @@ -0,0 +1,1 @@ +XML parser reported: unexpected end of file at line 1, column 1 diff -r 88044af67bd1 -r 56ff594b022c tests/test-parse-errors/expected/garbage.dat.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/test-parse-errors/expected/garbage.dat.txt Thu Feb 25 12:04:10 2016 +0000 @@ -0,0 +1,2 @@ +ERROR: RDF parser reported: +ERROR: XML parser reported: diff -r 88044af67bd1 -r 56ff594b022c tests/test-parse-errors/expected/invalid-turtle.ttl.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/test-parse-errors/expected/invalid-turtle.ttl.txt Thu Feb 25 12:04:10 2016 +0000 @@ -0,0 +1,1 @@ +RDF parser reported: Failed to import model from URL diff -r 88044af67bd1 -r 56ff594b022c tests/test-parse-errors/expected/invalid-xml.xml.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/test-parse-errors/expected/invalid-xml.xml.txt Thu Feb 25 12:04:10 2016 +0000 @@ -0,0 +1,1 @@ +XML parser reported: tag mismatch diff -r 88044af67bd1 -r 56ff594b022c tests/test-parse-errors/expected/valid-turtle-no-transform.ttl.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/test-parse-errors/expected/valid-turtle-no-transform.ttl.txt Thu Feb 25 12:04:10 2016 +0000 @@ -0,0 +1,1 @@ +valid RDF but defines no transforms diff -r 88044af67bd1 -r 56ff594b022c tests/test-parse-errors/expected/valid-xml-no-transform.xml.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/test-parse-errors/expected/valid-xml-no-transform.xml.txt Thu Feb 25 12:04:10 2016 +0000 @@ -0,0 +1,1 @@ +valid XML but defines no transform diff -r 88044af67bd1 -r 56ff594b022c tests/test-parse-errors/inputs/garbage.dat --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/test-parse-errors/inputs/garbage.dat Thu Feb 25 12:04:10 2016 +0000 @@ -0,0 +1,1 @@ +gZ~zN9Ԭb$7:2s𤇧0H2 zZ4#<An#|lTs:o_BKꥵ+-%WY[N-tLf7Ҷ \ No newline at end of file diff -r 88044af67bd1 -r 56ff594b022c tests/test-parse-errors/inputs/invalid-turtle.ttl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/test-parse-errors/inputs/invalid-turtle.ttl Thu Feb 25 12:04:10 2016 +0000 @@ -0,0 +1,2 @@ +# Trailing ; + ; diff -r 88044af67bd1 -r 56ff594b022c tests/test-parse-errors/inputs/invalid-xml.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/test-parse-errors/inputs/invalid-xml.xml Thu Feb 25 12:04:10 2016 +0000 @@ -0,0 +1,8 @@ + + + + A Title + http://example.com + + + diff -r 88044af67bd1 -r 56ff594b022c tests/test-parse-errors/inputs/valid-turtle-no-transform.ttl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/test-parse-errors/inputs/valid-turtle-no-transform.ttl Thu Feb 25 12:04:10 2016 +0000 @@ -0,0 +1,1 @@ + . diff -r 88044af67bd1 -r 56ff594b022c tests/test-parse-errors/inputs/valid-xml-no-transform.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/test-parse-errors/inputs/valid-xml-no-transform.xml Thu Feb 25 12:04:10 2016 +0000 @@ -0,0 +1,8 @@ + + + + A Title + http://example.com + + + diff -r 88044af67bd1 -r 56ff594b022c tests/test-parse-errors/test-parse-errors.sh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/test-parse-errors/test-parse-errors.sh Thu Feb 25 12:04:10 2016 +0000 @@ -0,0 +1,29 @@ +#!/bin/bash + +. ../include.sh + +infile=$audiopath/3clicks8.wav +tmpfile=$mypath/tmp_$$ +trap "rm -f $tmpfile" 0 + +for transform in "$mypath"/inputs/* ; do + + base=$(basename "$transform") + expected="$mypath"/expected/"$base".txt + + if [ ! -f "$expected" ]; then + fail "Internal error: Expected file $expected not found for transform $transform" + fi + + if $r -t "$transform" -w csv --csv-one-file /dev/null "$infile" 2>"$tmpfile" ; then + fail "Erroneously succeeds in running bogus transform $transform" + fi + + cat "$expected" | while read line; do + if ! fgrep -q "$line" "$tmpfile" ; then + fail "Expected output text \"$line\" not found in diagnostic output for transform $base" + fi + done + +done + diff -r 88044af67bd1 -r 56ff594b022c tests/test.sh --- a/tests/test.sh Thu Feb 25 10:53:10 2016 +0000 +++ b/tests/test.sh Thu Feb 25 12:04:10 2016 +0000 @@ -5,6 +5,7 @@ for x in \ supportprogs \ helpfulflags \ + parse-errors \ transforms-basic \ audioformat \ vamp-test-plugin \