diff tests/include.sh @ 191:4ef452f5fefc

Add (failing) test for JSON output format (fails for grid output)
author Chris Cannam
date Wed, 22 Jul 2015 14:25:14 +0100
parents 11a9ce2fa331
children 082c3f21f49e
line wrap: on
line diff
--- a/tests/include.sh	Mon Mar 02 17:21:59 2015 +0000
+++ b/tests/include.sh	Wed Jul 22 14:25:14 2015 +0100
@@ -67,4 +67,23 @@
     exit 1
 }
 
+failshow() {
+    echo "Test failed: $1"
+    if [ -n "$2" ]; then
+	echo "Output follows:"
+	echo "--"
+	cat $2
+	echo "--"
+    fi
+    exit 1
+}	
 
+check_json() {
+    test -f $1 || \
+	fail "Fails to write output to expected location $1 for $2"
+    cat $1 | json_verify -q || \
+	failshow "Writes invalid JSON to location $1 for $2" $1
+    rm -f $1
+}    
+
+