aboutsummaryrefslogtreecommitdiffhomepage
path: root/test
diff options
context:
space:
mode:
authorGravatar David Bremner <david@tethera.net>2014-03-11 13:52:19 -0300
committerGravatar David Bremner <david@tethera.net>2014-03-11 19:22:52 -0300
commit8c37821a0d09db8a231e0ef31d5862cbf902f77b (patch)
tree0a5e1358b00caef951b31ce58eceeaff11a572f6 /test
parent9b31c62680d6633d7d03cf416b593abfe02ced6d (diff)
test: add utility function to sort a json list
So far we only need this one place, but it's a bit messy to inline
Diffstat (limited to 'test')
-rw-r--r--test/test-lib.sh6
1 files changed, 6 insertions, 0 deletions
diff --git a/test/test-lib.sh b/test/test-lib.sh
index 66edb7c9..9824bb67 100644
--- a/test/test-lib.sh
+++ b/test/test-lib.sh
@@ -622,6 +622,12 @@ test_expect_equal_json () {
test_expect_equal "$output" "$expected" "$@"
}
+# Sort the top-level list of JSON data from stdin.
+test_sort_json () {
+ PYTHONIOENCODING=utf-8 python -c \
+ "import sys, json; json.dump(sorted(json.load(sys.stdin)),sys.stdout)"
+}
+
test_emacs_expect_t () {
test "$#" = 2 && { prereq=$1; shift; } || prereq=
test "$#" = 1 ||