From 4a02095f5ced7ed7bf9d4d06ed1c837387a22dd3 Mon Sep 17 00:00:00 2001 From: Tomi Ollila Date: Thu, 26 Jul 2012 06:24:58 +0300 Subject: [PATCH] Re: [PATCH 01/13] test: Uniformly canonicalize actual and expected JSON --- 4d/e57156ed8555841ab40f460be242ea101a0e7f | 77 +++++++++++++++++++++++ 1 file changed, 77 insertions(+) create mode 100644 4d/e57156ed8555841ab40f460be242ea101a0e7f diff --git a/4d/e57156ed8555841ab40f460be242ea101a0e7f b/4d/e57156ed8555841ab40f460be242ea101a0e7f new file mode 100644 index 000000000..8e78d6f9f --- /dev/null +++ b/4d/e57156ed8555841ab40f460be242ea101a0e7f @@ -0,0 +1,77 @@ +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 63F4D431FAF + for ; Wed, 25 Jul 2012 20:24:48 -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 j0YDdqq8+JuD for ; + Wed, 25 Jul 2012 20:24:47 -0700 (PDT) +Received: from guru.guru-group.fi (guru.guru-group.fi [46.183.73.34]) + by olra.theworths.org (Postfix) with ESMTP id B68C7431FAE + for ; Wed, 25 Jul 2012 20:24:47 -0700 (PDT) +Received: by guru.guru-group.fi (Postfix, from userid 501) + id 4227E10014E; Thu, 26 Jul 2012 06:24:58 +0300 (EEST) +From: Tomi Ollila +To: Austin Clements , notmuch@notmuchmail.org +Subject: Re: [PATCH 01/13] test: Uniformly canonicalize actual and expected + JSON +In-Reply-To: <1343183693-17134-2-git-send-email-amdragon@mit.edu> +References: <1343183693-17134-1-git-send-email-amdragon@mit.edu> + <1343183693-17134-2-git-send-email-amdragon@mit.edu> +User-Agent: Notmuch/0.13.2+103~g9610d35 (http://notmuchmail.org) Emacs/23.1.1 + (x86_64-redhat-linux-gnu) +X-Face: HhBM'cA~ +MIME-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +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: Thu, 26 Jul 2012 03:24:48 -0000 + +On Wed, Jul 25 2012, Austin Clements wrote: + +> Previously, we used a variety of ad-hoc canonicalizations for JSON +> output in the test suite, but were ultimately very sensitive to JSON +> irrelevancies such as whitespace. This introduces a new test +> comparison function, test_expect_equal_json, that first pretty-prints +> *both* the actual and expected JSON and the compares the result. +> +> The current implementation of this simply uses Python's json.tool to +> perform pretty-printing (with a fallback to the identity function if +> parsing fails). However, since the interface it introduces is +> semantically high-level, we could swap in other mechanisms in the +> future, such as another pretty-printer or something that does not +> re-order object keys (if we decide that we care about that). + + +The whole series looks good to me and was easy to read through. +The use of Python json.tool is pretty reasonable; It is shipped in +Python 2.6+ (For example perl does not ship json components by default, +making it more complicated to set up for this purpose). If that is too +"much", then we could also use tr -d '[:space:]' as an intermediate +solution (but that eats whitespace in quoted content too...) + +I'll be afk for a few days then I test this... + +Tomi -- 2.26.2