mirror of
https://git.notmuchmail.org/git/notmuch
synced 2024-11-22 02:48:08 +01:00
test-lib.sh: add test_valid_json
This test does exactly what it says on the tin. It expects JSON data to be parseable by Python, at least. Signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
This commit is contained in:
parent
92149485cb
commit
488e91f42b
1 changed files with 6 additions and 0 deletions
|
@ -524,6 +524,12 @@ test_expect_equal_json () {
|
||||||
test_expect_equal "$output" "$expected" "$@"
|
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.
|
# Sort the top-level list of JSON data from stdin.
|
||||||
test_sort_json () {
|
test_sort_json () {
|
||||||
PYTHONIOENCODING=utf-8 $NOTMUCH_PYTHON -c \
|
PYTHONIOENCODING=utf-8 $NOTMUCH_PYTHON -c \
|
||||||
|
|
Loading…
Reference in a new issue