diff tests/test-as-advertised/test-as-advertised.sh @ 197:3b7ec45abd1c

Add mandatory option --json-format to JSON feature writer, in preparation for supporting multiple JSON formats (perhaps) in future
author Chris Cannam
date Tue, 01 Sep 2015 17:05:32 +0100
parents b3d73c08b6ce
children f35bbb3e4d41
line wrap: on
line diff
--- a/tests/test-as-advertised/test-as-advertised.sh	Tue Sep 01 15:51:07 2015 +0100
+++ b/tests/test-as-advertised/test-as-advertised.sh	Tue Sep 01 17:05:32 2015 +0100
@@ -31,6 +31,10 @@
     # that have no values (but are only point events).  I don't know
     # how reasonable that is, but it's clearly intentional.  It also
     # writes to a subdirectory $basedir/$catid/$trackid.$output
+    #
+    # * The "json" reader has a mandatory --json-format parameter that
+    # currently only accepts one argument ("jams"). It should fail if
+    # run with any other value or without this parameter.
 
     case $type in
 	audiodb) 
@@ -42,6 +46,16 @@
 	    $r -t $onsets -w $type $tmpwav > $tmpdir/test.out 2>/dev/null || \
 		fail "Fails to run with reader type \"$type\" and default options"
 	    ;;
+	json)
+	    $r -t $onsets -w $type $tmpwav 2>/dev/null && \
+		fail "Wrongly succeeds in running with reader type \"$type\" and default options"
+	    $r -t $onsets -w $type $tmpwav --json-format blah 2>/dev/null && \
+		fail "Wrongly succeeds in running with reader type \"$type\" and unknown json-format option"
+	    $r -t $onsets -w $type $tmpwav --json-format 2>/dev/null && \
+		fail "Wrongly succeeds in running with reader type \"$type\" and empty json-format option"
+	    $r -t $onsets -w $type $tmpwav --json-format jams 2>/dev/null || \
+		fail "Fails to run with reader type \"$type\" and correct json-format option"
+	    ;;
 	*)
 	    $r -t $onsets -w $type $tmpwav 2>/dev/null || \
 		fail "Fails to run with reader type \"$type\" and default options"