From 160ad93b427311c7605d90811b8a3df682fa9cbe Mon Sep 17 00:00:00 2001 From: David Bremner Date: Wed, 12 Mar 2014 20:01:27 +2100 Subject: [PATCH] [Patch v6 01/14] test: add utility function to sort a json list --- af/ca626e078afca253a7c8b4dcf2b9466f84e353 | 73 +++++++++++++++++++++++ 1 file changed, 73 insertions(+) create mode 100644 af/ca626e078afca253a7c8b4dcf2b9466f84e353 diff --git a/af/ca626e078afca253a7c8b4dcf2b9466f84e353 b/af/ca626e078afca253a7c8b4dcf2b9466f84e353 new file mode 100644 index 000000000..97e859647 --- /dev/null +++ b/af/ca626e078afca253a7c8b4dcf2b9466f84e353 @@ -0,0 +1,73 @@ +Return-Path: +X-Original-To: notmuch@notmuchmail.org +Delivered-To: notmuch@notmuchmail.org +Received: from localhost (localhost [127.0.0.1]) + by olra.theworths.org (Postfix) with ESMTP id E54B2429E32 + for ; Tue, 11 Mar 2014 16:02:24 -0700 (PDT) +X-Virus-Scanned: Debian amavisd-new at olra.theworths.org +X-Spam-Flag: NO +X-Spam-Score: 0 +X-Spam-Level: +X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none] + autolearn=disabled +Received: from olra.theworths.org ([127.0.0.1]) + by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) + with ESMTP id 1dqfFKu1Xk5O for ; + Tue, 11 Mar 2014 16:02:24 -0700 (PDT) +Received: from yantan.tethera.net (yantan.tethera.net [199.188.72.155]) + (using TLSv1 with cipher DHE-RSA-AES128-SHA (128/128 bits)) + (No client certificate requested) + by olra.theworths.org (Postfix) with ESMTPS id 7D9F5431FDA + for ; Tue, 11 Mar 2014 16:02:07 -0700 (PDT) +Received: from remotemail by yantan.tethera.net with local (Exim 4.80) + (envelope-from ) + id 1WNVgV-0001ur-4v; Tue, 11 Mar 2014 20:02:07 -0300 +Received: (nullmailer pid 25839 invoked by uid 1000); Tue, 11 Mar 2014 + 23:01:45 -0000 +From: David Bremner +To: notmuch@notmuchmail.org +Subject: [Patch v6 01/14] test: add utility function to sort a json list +Date: Tue, 11 Mar 2014 20:01:27 -0300 +Message-Id: <1394578900-25618-2-git-send-email-david@tethera.net> +X-Mailer: git-send-email 1.8.5.3 +In-Reply-To: <1394578900-25618-1-git-send-email-david@tethera.net> +References: <1394578900-25618-1-git-send-email-david@tethera.net> +X-BeenThere: notmuch@notmuchmail.org +X-Mailman-Version: 2.1.13 +Precedence: list +List-Id: "Use and development of the notmuch mail system." + +List-Unsubscribe: , + +List-Archive: +List-Post: +List-Help: +List-Subscribe: , + +X-List-Received-Date: Tue, 11 Mar 2014 23:02:25 -0000 + +So far we only need this one place, but it's a bit messy to inline +--- + test/test-lib.sh | 6 ++++++ + 1 file changed, 6 insertions(+) + +diff --git a/test/test-lib.sh b/test/test-lib.sh +index 66edb7c..9824bb6 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 || +-- +1.8.5.3 + -- 2.26.2