From: Austin Clements Date: Wed, 25 Jul 2012 02:34:42 +0000 (+2000) Subject: [PATCH 02/13] test: Remove unnecessary JSON canonicalization X-Git-Url: http://git.tremily.us/gitweb.cgi?a=commitdiff_plain;h=d6d9c6b64d96e61565fabbbc7979468e7482931e;p=notmuch-archives.git [PATCH 02/13] test: Remove unnecessary JSON canonicalization --- diff --git a/c0/ae1b2e7e818dce872bc6ddfe63ad0843831fcc b/c0/ae1b2e7e818dce872bc6ddfe63ad0843831fcc new file mode 100644 index 000000000..baa456b45 --- /dev/null +++ b/c0/ae1b2e7e818dce872bc6ddfe63ad0843831fcc @@ -0,0 +1,238 @@ +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 D38FE431FAF + for ; Tue, 24 Jul 2012 19:35:20 -0700 (PDT) +X-Virus-Scanned: Debian amavisd-new at olra.theworths.org +X-Spam-Flag: NO +X-Spam-Score: -0.7 +X-Spam-Level: +X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5 + tests=[RCVD_IN_DNSWL_LOW=-0.7] 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 PEKHoKkuQOri for ; + Tue, 24 Jul 2012 19:35:18 -0700 (PDT) +Received: from dmz-mailsec-scanner-8.mit.edu (DMZ-MAILSEC-SCANNER-8.MIT.EDU + [18.7.68.37]) + by olra.theworths.org (Postfix) with ESMTP id 5997C431FC4 + for ; Tue, 24 Jul 2012 19:35:07 -0700 (PDT) +X-AuditID: 12074425-b7f9b6d0000008c4-17-500f5b593dc4 +Received: from mailhub-auth-4.mit.edu ( [18.7.62.39]) + by dmz-mailsec-scanner-8.mit.edu (Symantec Messaging Gateway) with SMTP + id 52.8F.02244.95B5F005; Tue, 24 Jul 2012 22:35:05 -0400 (EDT) +Received: from outgoing.mit.edu (OUTGOING-AUTH.MIT.EDU [18.7.22.103]) + by mailhub-auth-4.mit.edu (8.13.8/8.9.2) with ESMTP id q6P2Z5nu008582; + Tue, 24 Jul 2012 22:35:05 -0400 +Received: from drake.dyndns.org + (209-6-116-242.c3-0.arl-ubr1.sbo-arl.ma.cable.rcn.com + [209.6.116.242]) (authenticated bits=0) + (User authenticated as amdragon@ATHENA.MIT.EDU) + by outgoing.mit.edu (8.13.6/8.12.4) with ESMTP id q6P2Z2fL025118 + (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT); + Tue, 24 Jul 2012 22:35:04 -0400 (EDT) +Received: from amthrax by drake.dyndns.org with local (Exim 4.77) + (envelope-from ) + id 1StrRF-0004Yl-MW; Tue, 24 Jul 2012 22:35:01 -0400 +From: Austin Clements +To: notmuch@notmuchmail.org +Subject: [PATCH 02/13] test: Remove unnecessary JSON canonicalization +Date: Tue, 24 Jul 2012 22:34:42 -0400 +Message-Id: <1343183693-17134-3-git-send-email-amdragon@mit.edu> +X-Mailer: git-send-email 1.7.10 +In-Reply-To: <1343183693-17134-1-git-send-email-amdragon@mit.edu> +References: <1343183693-17134-1-git-send-email-amdragon@mit.edu> +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit +X-Brightmail-Tracker: + H4sIAAAAAAAAA+NgFmphleLIzCtJLcpLzFFi42IRYrdT142M5g8w2PbL2GJvQzujxfWbM5kd + mDwWb9rP5vFs1S3mAKYoLpuU1JzMstQifbsErowzx76yFHx1qdjxZjJzA+Nr6y5GTg4JAROJ + Nx83s0HYYhIX7q0Hsrk4hAT2MUp8ej+NHcLZwCjxtes4I4TziEni++ZvUM5cRonDLRNYQPrZ + BDQktu1fzghiiwhIS+y8O5sVxGYWMJOY+3Mi2A5hgWSJey1rmUBsFgFViSWdB8BsXgEHicWr + FjNC3CEv8fR+H1g9p4CjxPklC8HiQkA1PYuvsUPUC0qcnPkEaC8H0Hx1ifXzhCBWyUs0b53N + PIFRaBaSqlkIVbOQVC1gZF7FKJuSW6Wbm5iZU5yarFucnJiXl1qka6GXm1mil5pSuokRHNgu + qjsYJxxSOsQowMGoxMP76wlfgBBrYllxZe4hRkkOJiVR3opg/gAhvqT8lMqMxOKM+KLSnNTi + Q4wSHMxKIrxFYUA53pTEyqrUonyYlDQHi5I4742Um/5CAumJJanZqakFqUUwWRkODiUJ3tYo + oEbBotT01Iq0zJwShDQTByfIcB6g4awgNbzFBYm5xZnpEPlTjIpS4rzaIAkBkERGaR5cLyzx + vGIUB3pFmLcZpIoHmLTgul8BDWYCGvw8jA9kcEkiQkqqgdFn5pMu1d/vd4YcWPoqxorBQNj7 + RXH5z1MOv+3Ofq4PqpZ5eWzrI1kplRS2aSrJq6pz3Tksmqcy6HzfseE3Sx2vgpjLv77tQt4r + BMsU2d+vXOOQ66plJaltECQcdc7F8IjWtrvLF2sqX1qrpV2UYPHtWR7Hmbfc+7e8mac7dZNR + V/3T+jkr7iqxFGckGmoxFxUnAgA+N6KFFwMAAA== +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: Wed, 25 Jul 2012 02:35:21 -0000 + +Format canonicalization of JSON output is no longer necessary, so +remove it. Value canonicalization (e.g., normalizing thread IDs) is +still necessary, so all of the sanitization functions remain. +--- + test/json | 4 ++-- + test/maildir-sync | 1 - + test/multipart | 40 ++++++++++------------------------------ + 3 files changed, 12 insertions(+), 33 deletions(-) + +diff --git a/test/json b/test/json +index d86ee46..ac8fa8e 100755 +--- a/test/json ++++ b/test/json +@@ -18,7 +18,7 @@ test_expect_equal_json "$output" "[[[{\"id\": \"${gen_msg_id}\", \"match\": true + + test_begin_subtest "Search message: json" + add_message "[subject]=\"json-search-subject\"" "[date]=\"Sat, 01 Jan 2000 12:00:00 -0000\"" "[body]=\"json-search-message\"" +-output=$(notmuch search --format=json "json-search-message" | notmuch_json_show_sanitize | notmuch_search_sanitize) ++output=$(notmuch search --format=json "json-search-message" | notmuch_search_sanitize) + test_expect_equal_json "$output" "[{\"thread\": \"XXX\", + \"timestamp\": 946728000, + \"date_relative\": \"2000-01-01\", +@@ -49,7 +49,7 @@ test_expect_equal_json "$output" "[[[{\"id\": \"$id\", \"match\": true, \"exclud + + test_begin_subtest "Search message: json, utf-8" + add_message "[subject]=\"json-search-utf8-body-sübjéct\"" "[date]=\"Sat, 01 Jan 2000 12:00:00 -0000\"" "[body]=\"jsön-search-méssage\"" +-output=$(notmuch search --format=json "jsön-search-méssage" | notmuch_json_show_sanitize | notmuch_search_sanitize) ++output=$(notmuch search --format=json "jsön-search-méssage" | notmuch_search_sanitize) + test_expect_equal_json "$output" "[{\"thread\": \"XXX\", + \"timestamp\": 946728000, + \"date_relative\": \"2000-01-01\", +diff --git a/test/maildir-sync b/test/maildir-sync +index b748d04..cd7d241 100755 +--- a/test/maildir-sync ++++ b/test/maildir-sync +@@ -7,7 +7,6 @@ test_description="maildir synchronization" + # Avoid including the local value of MAIL_DIR in the result. + filter_show_json() { + sed -e "s|${MAIL_DIR}/|MAIL_DIR/|" +- echo + } + + # Create the expected maildir structure +diff --git a/test/multipart b/test/multipart +index 3ccf27f..0527f84 100755 +--- a/test/multipart ++++ b/test/multipart +@@ -319,10 +319,8 @@ test_expect_success \ + "notmuch show --format=text --part=8 'id:87liy5ap00.fsf@yoom.home.cworth.org'" + + test_begin_subtest "--format=json --part=0, full message" +-notmuch show --format=json --part=0 'id:87liy5ap00.fsf@yoom.home.cworth.org' | sed 's|{"id":|\n{"id":|g' >OUTPUT +-echo >>OUTPUT # expect *no* newline at end of output ++notmuch show --format=json --part=0 'id:87liy5ap00.fsf@yoom.home.cworth.org' >OUTPUT + cat <EXPECTED +- + {"id": "87liy5ap00.fsf@yoom.home.cworth.org", "match": true, "excluded": false, "filename": "${MAIL_DIR}/multipart", "timestamp": 978709437, "date_relative": "2001-01-05", "tags": ["attachment","inbox","signed","unread"], "headers": {"Subject": "Multipart message", "From": "Carl Worth ", "To": "cworth@cworth.org", "Date": "Fri, 05 Jan 2001 15:43:57 +0000"}, "body": [ + {"id": 1, "content-type": "multipart/signed", "content": [ + {"id": 2, "content-type": "multipart/mixed", "content": [ +@@ -337,10 +335,8 @@ EOF + test_expect_equal_json "$(cat OUTPUT)" "$(cat EXPECTED)" + + test_begin_subtest "--format=json --part=1, message body" +-notmuch show --format=json --part=1 'id:87liy5ap00.fsf@yoom.home.cworth.org' | sed 's|{"id":|\n{"id":|g' >OUTPUT +-echo >>OUTPUT # expect *no* newline at end of output ++notmuch show --format=json --part=1 'id:87liy5ap00.fsf@yoom.home.cworth.org' >OUTPUT + cat <EXPECTED +- + {"id": 1, "content-type": "multipart/signed", "content": [ + {"id": 2, "content-type": "multipart/mixed", "content": [ + {"id": 3, "content-type": "message/rfc822", "content": [{"headers": {"Subject": "html message", "From": "Carl Worth ", "To": "cworth@cworth.org", "Date": "Fri, 05 Jan 2001 15:42:57 +0000"}, "body": [ +@@ -354,10 +350,8 @@ EOF + test_expect_equal_json "$(cat OUTPUT)" "$(cat EXPECTED)" + + test_begin_subtest "--format=json --part=2, multipart/mixed" +-notmuch show --format=json --part=2 'id:87liy5ap00.fsf@yoom.home.cworth.org' | sed 's|{"id":|\n{"id":|g' >OUTPUT +-echo >>OUTPUT # expect *no* newline at end of output ++notmuch show --format=json --part=2 'id:87liy5ap00.fsf@yoom.home.cworth.org' >OUTPUT + cat <EXPECTED +- + {"id": 2, "content-type": "multipart/mixed", "content": [ + {"id": 3, "content-type": "message/rfc822", "content": [{"headers": {"Subject": "html message", "From": "Carl Worth ", "To": "cworth@cworth.org", "Date": "Fri, 05 Jan 2001 15:42:57 +0000"}, "body": [ + {"id": 4, "content-type": "multipart/alternative", "content": [ +@@ -369,10 +363,8 @@ EOF + test_expect_equal_json "$(cat OUTPUT)" "$(cat EXPECTED)" + + test_begin_subtest "--format=json --part=3, rfc822 part" +-notmuch show --format=json --part=3 'id:87liy5ap00.fsf@yoom.home.cworth.org' | sed 's|{"id":|\n{"id":|g' >OUTPUT +-echo >>OUTPUT # expect *no* newline at end of output ++notmuch show --format=json --part=3 'id:87liy5ap00.fsf@yoom.home.cworth.org' >OUTPUT + cat <EXPECTED +- + {"id": 3, "content-type": "message/rfc822", "content": [{"headers": {"Subject": "html message", "From": "Carl Worth ", "To": "cworth@cworth.org", "Date": "Fri, 05 Jan 2001 15:42:57 +0000"}, "body": [ + {"id": 4, "content-type": "multipart/alternative", "content": [ + {"id": 5, "content-type": "text/html"}, +@@ -381,10 +373,8 @@ EOF + test_expect_equal_json "$(cat OUTPUT)" "$(cat EXPECTED)" + + test_begin_subtest "--format=json --part=4, rfc822's multipart/alternative" +-notmuch show --format=json --part=4 'id:87liy5ap00.fsf@yoom.home.cworth.org' | sed 's|{"id":|\n{"id":|g' >OUTPUT +-echo >>OUTPUT # expect *no* newline at end of output ++notmuch show --format=json --part=4 'id:87liy5ap00.fsf@yoom.home.cworth.org' >OUTPUT + cat <EXPECTED +- + {"id": 4, "content-type": "multipart/alternative", "content": [ + {"id": 5, "content-type": "text/html"}, + {"id": 6, "content-type": "text/plain", "content": "This is an embedded message, with a multipart/alternative part.\n"}]} +@@ -392,46 +382,36 @@ EOF + test_expect_equal_json "$(cat OUTPUT)" "$(cat EXPECTED)" + + test_begin_subtest "--format=json --part=5, rfc822's html part" +-notmuch show --format=json --part=5 'id:87liy5ap00.fsf@yoom.home.cworth.org' | sed 's|{"id":|\n{"id":|g' >OUTPUT +-echo >>OUTPUT # expect *no* newline at end of output ++notmuch show --format=json --part=5 'id:87liy5ap00.fsf@yoom.home.cworth.org' >OUTPUT + cat <EXPECTED +- + {"id": 5, "content-type": "text/html"} + EOF + test_expect_equal_json "$(cat OUTPUT)" "$(cat EXPECTED)" + + test_begin_subtest "--format=json --part=6, rfc822's text part" +-notmuch show --format=json --part=6 'id:87liy5ap00.fsf@yoom.home.cworth.org' | sed 's|{"id":|\n{"id":|g' >OUTPUT +-echo >>OUTPUT # expect *no* newline at end of output ++notmuch show --format=json --part=6 'id:87liy5ap00.fsf@yoom.home.cworth.org' >OUTPUT + cat <EXPECTED +- + {"id": 6, "content-type": "text/plain", "content": "This is an embedded message, with a multipart/alternative part.\n"} + EOF + test_expect_equal_json "$(cat OUTPUT)" "$(cat EXPECTED)" + + test_begin_subtest "--format=json --part=7, inline attachment" +-notmuch show --format=json --part=7 'id:87liy5ap00.fsf@yoom.home.cworth.org' | sed 's|{"id":|\n{"id":|g' >OUTPUT +-echo >>OUTPUT # expect *no* newline at end of output ++notmuch show --format=json --part=7 'id:87liy5ap00.fsf@yoom.home.cworth.org' >OUTPUT + cat <EXPECTED +- + {"id": 7, "content-type": "text/plain", "filename": "attachment", "content": "This is a text attachment.\n"} + EOF + test_expect_equal_json "$(cat OUTPUT)" "$(cat EXPECTED)" + + test_begin_subtest "--format=json --part=8, plain text part" +-notmuch show --format=json --part=8 'id:87liy5ap00.fsf@yoom.home.cworth.org' | sed 's|{"id":|\n{"id":|g' >OUTPUT +-echo >>OUTPUT # expect *no* newline at end of output ++notmuch show --format=json --part=8 'id:87liy5ap00.fsf@yoom.home.cworth.org' >OUTPUT + cat <EXPECTED +- + {"id": 8, "content-type": "text/plain", "content": "And this message is signed.\n\n-Carl\n"} + EOF + test_expect_equal_json "$(cat OUTPUT)" "$(cat EXPECTED)" + + test_begin_subtest "--format=json --part=9, pgp signature (unverified)" +-notmuch show --format=json --part=9 'id:87liy5ap00.fsf@yoom.home.cworth.org' | sed 's|{"id":|\n{"id":|g' >OUTPUT +-echo >>OUTPUT # expect *no* newline at end of output ++notmuch show --format=json --part=9 'id:87liy5ap00.fsf@yoom.home.cworth.org' >OUTPUT + cat <EXPECTED +- + {"id": 9, "content-type": "application/pgp-signature"} + EOF + test_expect_equal_json "$(cat OUTPUT)" "$(cat EXPECTED)" +-- +1.7.10 +