X-Git-Url: https://git.cworth.org/git?a=blobdiff_plain;f=test%2Ftest-lib.sh;h=d2b2a47f495d6025e77dd2a5ad5ed56ccf9474f4;hb=8c772eaa0dfe227d998e5d5f7b97bd514f3eae3c;hp=c505e76432669db0f0bdba8f5898de1a0d423a2e;hpb=eb232ee0aba8f031fe4f0cb509682a321d85e06e;p=notmuch diff --git a/test/test-lib.sh b/test/test-lib.sh index c505e764..d2b2a47f 100644 --- a/test/test-lib.sh +++ b/test/test-lib.sh @@ -450,9 +450,10 @@ test_expect_equal_json () { # The test suite forces LC_ALL=C, but this causes Python 3 to # decode stdin as ASCII. We need to read JSON in UTF-8, so # override Python's stdio encoding defaults. - output=$(echo "$1" | PYTHONIOENCODING=utf-8 $NOTMUCH_PYTHON -mjson.tool \ + local script='import json, sys; json.dump(json.load(sys.stdin), sys.stdout, sort_keys=True, indent=4)' + output=$(echo "$1" | PYTHONIOENCODING=utf-8 $NOTMUCH_PYTHON -c "$script" \ || echo "$1") - expected=$(echo "$2" | PYTHONIOENCODING=utf-8 $NOTMUCH_PYTHON -mjson.tool \ + expected=$(echo "$2" | PYTHONIOENCODING=utf-8 $NOTMUCH_PYTHON -c "$script" \ || echo "$2") shift 2 test_expect_equal "$output" "$expected" "$@"