Re: [PATCH v2 3/3] test: conform to content length, encoding fields
authorEthan Glasser-Camp <ethan.glasser.camp@gmail.com>
Sat, 20 Oct 2012 02:21:46 +0000 (22:21 +2000)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:49:53 +0000 (09:49 -0800)
3a/d706eb0029476fce3e0a6a9fa8880113dea1eb [new file with mode: 0644]

diff --git a/3a/d706eb0029476fce3e0a6a9fa8880113dea1eb b/3a/d706eb0029476fce3e0a6a9fa8880113dea1eb
new file mode 100644 (file)
index 0000000..c1845ff
--- /dev/null
@@ -0,0 +1,100 @@
+Return-Path: <ethan.glasser.camp@gmail.com>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+       by olra.theworths.org (Postfix) with ESMTP id 22102431FBD\r
+       for <notmuch@notmuchmail.org>; Fri, 19 Oct 2012 19:21:54 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -0.799\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-0.799 tagged_above=-999 required=5\r
+       tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,\r
+       FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+       by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+       with ESMTP id bzpkI2awr55I for <notmuch@notmuchmail.org>;\r
+       Fri, 19 Oct 2012 19:21:52 -0700 (PDT)\r
+Received: from mail-vc0-f181.google.com (mail-vc0-f181.google.com\r
+       [209.85.220.181]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
+       (No client certificate requested)\r
+       by olra.theworths.org (Postfix) with ESMTPS id C11B4431FAE\r
+       for <notmuch@notmuchmail.org>; Fri, 19 Oct 2012 19:21:52 -0700 (PDT)\r
+Received: by mail-vc0-f181.google.com with SMTP id n11so1232678vch.26\r
+       for <notmuch@notmuchmail.org>; Fri, 19 Oct 2012 19:21:52 -0700 (PDT)\r
+DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;\r
+       h=from:to:subject:in-reply-to:references:user-agent:date:message-id\r
+       :mime-version:content-type;\r
+       bh=IA8AT1hJRd8y3hQkhlfztVsXyqnQmZ8cInBQVaYVlIs=;\r
+       b=znGLbSEngVozpDZS5t9xbe78X6WEpk0fB/3VptoRHodCmtPCee8Q6SnhgL/ZtCdfjJ\r
+       4nsLozopjDmDH/K5TcssG9HfRcqPT+kPqXWRevsR1R6CfJY1lo6re93PonHZ962+27L3\r
+       OqUCSquPyolihrrhMRdE91kZArHEdoMp/19v1eJNJN6C/L77q6v+zi4WLxCnHivq6pMD\r
+       Uc9MoZRJlplQzngjy9V92kKLLgmg592j9dT7pxYv7uZeSu9Z21CVmtOtSVV+mDDjAkjl\r
+       VxFj2fhyswJd68zsDuzOwwefeG/8d9BhvkaWB34FXiq4EGl4MaFnxfzrVANtk0uERDwH\r
+       mN1Q==\r
+Received: by 10.220.157.75 with SMTP id a11mr4077253vcx.27.1350699712239;\r
+       Fri, 19 Oct 2012 19:21:52 -0700 (PDT)\r
+Received: from smtp.gmail.com (p70-80.acedsl.com. [66.114.70.80])\r
+       by mx.google.com with ESMTPS id dq8sm2682429vdc.4.2012.10.19.19.21.50\r
+       (version=TLSv1/SSLv3 cipher=OTHER);\r
+       Fri, 19 Oct 2012 19:21:51 -0700 (PDT)\r
+From: Ethan Glasser-Camp <ethan.glasser.camp@gmail.com>\r
+To: Peter Wang <novalazy@gmail.com>, notmuch@notmuchmail.org\r
+Subject: Re: [PATCH v2 3/3] test: conform to content length, encoding fields\r
+In-Reply-To: <1344428872-12374-4-git-send-email-novalazy@gmail.com>\r
+References: <1344428872-12374-1-git-send-email-novalazy@gmail.com>\r
+       <1344428872-12374-4-git-send-email-novalazy@gmail.com>\r
+User-Agent: Notmuch/0.14+45~g6ea9330 (http://notmuchmail.org) Emacs/23.3.1\r
+       (x86_64-pc-linux-gnu)\r
+Date: Fri, 19 Oct 2012 22:21:46 -0400\r
+Message-ID: <877gql7uit.fsf@betacantrips.com>\r
+MIME-Version: 1.0\r
+Content-Type: text/plain; charset=us-ascii\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+       <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Sat, 20 Oct 2012 02:21:54 -0000\r
+\r
+Peter Wang <novalazy@gmail.com> writes:\r
+\r
+> Update tests to expect content-length and content-transfer-encoding\r
+> fields in show --format=json output, for leaf parts with omitted body\r
+> content.\r
+\r
+These three patches all look fine to me, except for the following\r
+problem.\r
+\r
+> diff --git a/test/json b/test/json\r
+> index ac8fa8e..8ce2e8a 100755\r
+> --- a/test/json\r
+> +++ b/test/json\r
+> @@ -45,7 +45,7 @@ emacs_deliver_message \\r
+>       (insert \"Message-ID: <$id>\n\")"\r
+>  output=$(notmuch show --format=json "id:$id")\r
+>  filename=$(notmuch search --output=files "id:$id")\r
+> -test_expect_equal_json "$output" "[[[{\"id\": \"$id\", \"match\": true, \"excluded\": false, \"filename\": \"$filename\", \"timestamp\": 946728000, \"date_relative\": \"2000-01-01\", \"tags\": [\"inbox\"], \"headers\": {\"Subject\": \"$subject\", \"From\": \"Notmuch Test Suite <test_suite@notmuchmail.org>\", \"To\": \"test_suite@notmuchmail.org\", \"Date\": \"Sat, 01 Jan 2000 12:00:00 +0000\"}, \"body\": [{\"id\": 1, \"content-type\": \"multipart/mixed\", \"content\": [{\"id\": 2, \"content-type\": \"text/plain\", \"content\": \"This is a test message with inline attachment with a filename\"}, {\"id\": 3, \"content-type\": \"application/octet-stream\", \"filename\": \"README\"}]}]}, []]]]"\r
+> +test_expect_equal_json "$output" "[[[{\"id\": \"$id\", \"match\": true, \"excluded\": false, \"filename\": \"$filename\", \"timestamp\": 946728000, \"date_relative\": \"2000-01-01\", \"tags\": [\"inbox\"], \"headers\": {\"Subject\": \"$subject\", \"From\": \"Notmuch Test Suite <test_suite@notmuchmail.org>\", \"To\": \"test_suite@notmuchmail.org\", \"Date\": \"Sat, 01 Jan 2000 12:00:00 +0000\"}, \"body\": [{\"id\": 1, \"content-type\": \"multipart/mixed\", \"content\": [{\"id\": 2, \"content-type\": \"text/plain\", \"content\": \"This is a test message with inline attachment with a filename\"}, {\"id\": 3, \"content-type\": \"application/octet-stream\", \"content-length\": 12392, \"content-transfer-encoding\": \"base64\", \"filename\": \"README\"}]}]}, []]]]"\r
+\r
+This test fails for me. You're encoding the content-length of\r
+test/README. test/README certainly hasn't changed in the last six months\r
+so that seems like a reasonable thing to do... except then why is it\r
+12392 on your machine, and 12380 on mine? I don't object to using\r
+test/README as a simple file to test with, but then you certainly\r
+shouldn't hard-code its length. You could pipe test/README through\r
+base64 and then through wc -c to get an accurate length, but for my\r
+machine a newline gets appended by base64 I think, and it gives me\r
+12381.\r
+\r
+I'm tagging this patch moreinfo but you would have my +1 if you fix\r
+this.\r
+\r
+Ethan\r