unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: Ethan Glasser-Camp <ethan.glasser.camp@gmail.com>
To: Peter Wang <novalazy@gmail.com>, notmuch@notmuchmail.org
Subject: Re: [PATCH v2 3/3] test: conform to content length, encoding fields
Date: Fri, 19 Oct 2012 22:21:46 -0400	[thread overview]
Message-ID: <877gql7uit.fsf@betacantrips.com> (raw)
In-Reply-To: <1344428872-12374-4-git-send-email-novalazy@gmail.com>

Peter Wang <novalazy@gmail.com> writes:

> Update tests to expect content-length and content-transfer-encoding
> fields in show --format=json output, for leaf parts with omitted body
> content.

These three patches all look fine to me, except for the following
problem.

> diff --git a/test/json b/test/json
> index ac8fa8e..8ce2e8a 100755
> --- a/test/json
> +++ b/test/json
> @@ -45,7 +45,7 @@ emacs_deliver_message \
>       (insert \"Message-ID: <$id>\n\")"
>  output=$(notmuch show --format=json "id:$id")
>  filename=$(notmuch search --output=files "id:$id")
> -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\"}]}]}, []]]]"
> +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\"}]}]}, []]]]"

This test fails for me. You're encoding the content-length of
test/README. test/README certainly hasn't changed in the last six months
so that seems like a reasonable thing to do... except then why is it
12392 on your machine, and 12380 on mine? I don't object to using
test/README as a simple file to test with, but then you certainly
shouldn't hard-code its length. You could pipe test/README through
base64 and then through wc -c to get an accurate length, but for my
machine a newline gets appended by base64 I think, and it gives me
12381.

I'm tagging this patch moreinfo but you would have my +1 if you fix
this.

Ethan

  reply	other threads:[~2012-10-20  2:21 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-08 12:27 [PATCH v2 0/3] indicate length of omitted body content Peter Wang
2012-08-08 12:27 ` [PATCH v2 1/3] test: normalize only message filenames in show json Peter Wang
2012-08-08 12:27 ` [PATCH v2 2/3] show: indicate length, encoding of omitted body content Peter Wang
2012-08-08 12:27 ` [PATCH v2 3/3] test: conform to content length, encoding fields Peter Wang
2012-10-20  2:21   ` Ethan Glasser-Camp [this message]
2012-10-21  3:03     ` Peter Wang
2012-10-21  3:04   ` [PATCH v3] " Peter Wang
2012-10-21 12:53     ` Ethan Glasser-Camp

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://notmuchmail.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=877gql7uit.fsf@betacantrips.com \
    --to=ethan.glasser.camp@gmail.com \
    --cc=notmuch@notmuchmail.org \
    --cc=novalazy@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).