X-Git-Url: https://git.notmuchmail.org/git?a=blobdiff_plain;f=test%2Ftest-lib.sh;h=616cb674ccd9ee36df8026a87805e28a5730f890;hb=4c5b17b10b786994255641fee8df4733c3586f3e;hp=ff18fae616b2aaf1a27dae10216309ded3006349;hpb=3563079be37737aab084e957b494070eaea9c2f6;p=notmuch diff --git a/test/test-lib.sh b/test/test-lib.sh index ff18fae6..616cb674 100644 --- a/test/test-lib.sh +++ b/test/test-lib.sh @@ -507,6 +507,30 @@ test_sort_json () { "import sys, json; json.dump(sorted(json.load(sys.stdin)),sys.stdout)" } +# test for json objects: +# read the source of test/json_check_nodes.py (or the output when +# invoking it without arguments) for an explanation of the syntax. +test_json_nodes () { + exec 1>&6 2>&7 # Restore stdout and stderr + if [ -z "$inside_subtest" ]; then + error "bug in the test script: test_json_eval without test_begin_subtest" + fi + inside_subtest= + test "$#" > 0 || + error "bug in the test script: test_json_nodes needs at least 1 parameter" + + if ! test_skip "$test_subtest_name" + then + output=$(PYTHONIOENCODING=utf-8 $NOTMUCH_PYTHON "$TEST_DIRECTORY"/json_check_nodes.py "$@") + if [ "$?" = 0 ] + then + test_ok_ + else + test_failure_ "$output" + fi + fi +} + test_emacs_expect_t () { test "$#" = 1 || error "bug in the test script: not 1 parameter to test_emacs_expect_t"