X-Git-Url: https://git.notmuchmail.org/git?p=notmuch;a=blobdiff_plain;f=test%2Ftest-lib.sh;h=43fffa09c639a91b9461c0faea0a6bc9bcfd1d01;hp=cb5bb8941b52cd230e80f43a533b07bdf2ee4fec;hb=488e91f42b95c116b387212c90ea47c43c716f5b;hpb=92149485cb5cd4af3d2c6c4856a2423da92dc727 diff --git a/test/test-lib.sh b/test/test-lib.sh index cb5bb894..43fffa09 100644 --- a/test/test-lib.sh +++ b/test/test-lib.sh @@ -524,6 +524,12 @@ test_expect_equal_json () { test_expect_equal "$output" "$expected" "$@" } +# Ensure that the argument is valid JSON data. +test_valid_json () { + PYTHONIOENCODING=utf-8 $NOTMUCH_PYTHON -c "import sys, json; json.load(sys.stdin)" <<<"$1" + test_expect_equal "$?" 0 +} + # Sort the top-level list of JSON data from stdin. test_sort_json () { PYTHONIOENCODING=utf-8 $NOTMUCH_PYTHON -c \