unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: Tomi Ollila <tomi.ollila@iki.fi>
To: Austin Clements <amdragon@MIT.EDU>, notmuch@notmuchmail.org
Subject: Re: [PATCH] test: Quote $output in calls to test_expect_equal
Date: Tue, 27 Nov 2012 12:04:18 +0200	[thread overview]
Message-ID: <m27gp7nyzh.fsf@guru.guru-group.fi> (raw)
In-Reply-To: <1353992297-14473-1-git-send-email-amdragon@mit.edu>

On Tue, Nov 27 2012, Austin Clements <amdragon@MIT.EDU> wrote:

> Previously, many tests in emacs-subject-to-filename didn't quote the
> $output argument to test_expect_equal.  As a result, if $output was
> empty, test_expect_equal would be passed only one argument and would
> abort the entire test script.  By quoting the argument, we ensure
> test_expect_equal will always receive two arguments.
> ---

Looks SO good to me. +1 !

Tomi

PS: we should do something to detect aborting scripts
    some options: 1) trap, 2) detect test_done not run, 3) return value
            4) at the beginning of script state count of expexted tests

>  test/emacs-subject-to-filename |   18 +++++++++---------
>  1 file changed, 9 insertions(+), 9 deletions(-)
>
> diff --git a/test/emacs-subject-to-filename b/test/emacs-subject-to-filename
> index a0ffdfe..1e94a98 100755
> --- a/test/emacs-subject-to-filename
> +++ b/test/emacs-subject-to-filename
> @@ -60,55 +60,55 @@ test_begin_subtest "filename #1"
>  output=$(test_emacs '(notmuch-wash-subject-to-filename
>        "just a subject line")'
>  )
> -test_expect_equal $output '"just-a-subject-line"'
> +test_expect_equal "$output" '"just-a-subject-line"'
>  
>  test_begin_subtest "filename #2"
>  output=$(test_emacs '(notmuch-wash-subject-to-filename
>        " [any]  [prefixes are ] [removed!] from the subject")'
>  )
> -test_expect_equal $output '"from-the-subject"'
> +test_expect_equal "$output" '"from-the-subject"'
>  
>  test_begin_subtest "filename #3"
>  output=$(test_emacs '(notmuch-wash-subject-to-filename
>        "  leading and trailing space  ")'
>  )
> -test_expect_equal $output '"leading-and-trailing-space"'
> +test_expect_equal "$output" '"leading-and-trailing-space"'
>  
>  test_begin_subtest "filename #4"
>  output=$(test_emacs '(notmuch-wash-subject-to-filename
>        "!#  leading ()// &%, and in between_and_trailing garbage ()(&%%")'
>  )
> -test_expect_equal $output '"-leading-and-in-between_and_trailing-garbage"'
> +test_expect_equal "$output" '"-leading-and-in-between_and_trailing-garbage"'
>  
>  test_begin_subtest "filename #5"
>  output=$(test_emacs '(notmuch-wash-subject-to-filename
>        "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz.-_01234567890")'
>  )
> -test_expect_equal $output '"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz.-_01234567890"'
> +test_expect_equal "$output" '"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz.-_01234567890"'
>  
>  test_begin_subtest "filename #6"
>  output=$(test_emacs '(notmuch-wash-subject-to-filename
>        "sequences of ... are squashed and trailing are removed ...")'
>  )
> -test_expect_equal $output '"sequences-of-.-are-squashed-and-trailing-are-removed"'
> +test_expect_equal "$output" '"sequences-of-.-are-squashed-and-trailing-are-removed"'
>  
>  test_begin_subtest "filename #7"
>  output=$(test_emacs '(notmuch-wash-subject-to-filename
>        "max length test" 1)'
>  )
> -test_expect_equal $output '"m"'
> +test_expect_equal "$output" '"m"'
>  
>  test_begin_subtest "filename #8"
>  output=$(test_emacs '(notmuch-wash-subject-to-filename
>        "max length test /&(/%&/%%&¤%¤" 20)'
>  )
> -test_expect_equal $output '"max-length-test"'
> +test_expect_equal "$output" '"max-length-test"'
>  
>  test_begin_subtest "filename #9"
>  output=$(test_emacs '(notmuch-wash-subject-to-filename
>        "[a prefix] [is only separated] by [spaces], so \"by\" is not okay!")'
>  )
> -test_expect_equal $output '"by-spaces-so-by-is-not-okay"'
> +test_expect_equal "$output" '"by-spaces-so-by-is-not-okay"'
>  
>  # test notmuch-wash-subject-to-patch-filename (subject)
>  test_begin_subtest "patch filename #1"
> -- 
> 1.7.10.4
>
> _______________________________________________
> notmuch mailing list
> notmuch@notmuchmail.org
> http://notmuchmail.org/mailman/listinfo/notmuch

  reply	other threads:[~2012-11-27 10:04 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-27  4:58 [PATCH] test: Quote $output in calls to test_expect_equal Austin Clements
2012-11-27 10:04 ` Tomi Ollila [this message]
2012-11-27 14:40 ` David Bremner

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=m27gp7nyzh.fsf@guru.guru-group.fi \
    --to=tomi.ollila@iki.fi \
    --cc=amdragon@MIT.EDU \
    --cc=notmuch@notmuchmail.org \
    /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).