From 0059d3088426dda08f201e60de7e9512f321c2ab Mon Sep 17 00:00:00 2001 From: Tomi Ollila Date: Tue, 27 Nov 2012 12:04:18 +0200 Subject: [PATCH] Re: [PATCH] test: Quote $output in calls to test_expect_equal --- 59/98d35ae1942f216a5597afb7ce4d86028e97d8 | 156 ++++++++++++++++++++++ 1 file changed, 156 insertions(+) create mode 100644 59/98d35ae1942f216a5597afb7ce4d86028e97d8 diff --git a/59/98d35ae1942f216a5597afb7ce4d86028e97d8 b/59/98d35ae1942f216a5597afb7ce4d86028e97d8 new file mode 100644 index 000000000..2a913a64f --- /dev/null +++ b/59/98d35ae1942f216a5597afb7ce4d86028e97d8 @@ -0,0 +1,156 @@ +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 78CA2431FAF + for ; Tue, 27 Nov 2012 02:04:24 -0800 (PST) +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 PcdLMyzXn93I for ; + Tue, 27 Nov 2012 02:04:23 -0800 (PST) +Received: from guru.guru-group.fi (guru.guru-group.fi [46.183.73.34]) + by olra.theworths.org (Postfix) with ESMTP id 39538431FAE + for ; Tue, 27 Nov 2012 02:04:23 -0800 (PST) +Received: from guru.guru-group.fi (localhost [IPv6:::1]) + by guru.guru-group.fi (Postfix) with ESMTP id 8DC8F1000E5; + Tue, 27 Nov 2012 12:04:19 +0200 (EET) +From: Tomi Ollila +To: Austin Clements , notmuch@notmuchmail.org +Subject: Re: [PATCH] test: Quote $output in calls to test_expect_equal +In-Reply-To: <1353992297-14473-1-git-send-email-amdragon@mit.edu> +References: <1353992297-14473-1-git-send-email-amdragon@mit.edu> +User-Agent: Notmuch/0.14+84~g8a199bf (http://notmuchmail.org) Emacs/24.2.1 + (x86_64-unknown-linux-gnu) +X-Face: HhBM'cA~ +MIME-Version: 1.0 +Content-Type: text/plain; charset=utf-8 +Content-Transfer-Encoding: quoted-printable +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: Tue, 27 Nov 2012 10:04:24 -0000 + +On Tue, Nov 27 2012, Austin Clements 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-filen= +ame +> 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=3D$(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"' +>=20=20 +> test_begin_subtest "filename #2" +> output=3D$(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"' +>=20=20 +> test_begin_subtest "filename #3" +> output=3D$(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"' +>=20=20 +> test_begin_subtest "filename #4" +> output=3D$(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-garba= +ge"' +>=20=20 +> test_begin_subtest "filename #5" +> output=3D$(test_emacs '(notmuch-wash-subject-to-filename +> "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz.-_0123456789= +0")' +> ) +> -test_expect_equal $output '"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqr= +stuvwxyz.-_01234567890"' +> +test_expect_equal "$output" '"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnop= +qrstuvwxyz.-_01234567890"' +>=20=20 +> test_begin_subtest "filename #6" +> output=3D$(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-a= +re-removed"' +>=20=20 +> test_begin_subtest "filename #7" +> output=3D$(test_emacs '(notmuch-wash-subject-to-filename +> "max length test" 1)' +> ) +> -test_expect_equal $output '"m"' +> +test_expect_equal "$output" '"m"' +>=20=20 +> test_begin_subtest "filename #8" +> output=3D$(test_emacs '(notmuch-wash-subject-to-filename +> "max length test /&(/%&/%%&=C2=A4%=C2=A4" 20)' +> ) +> -test_expect_equal $output '"max-length-test"' +> +test_expect_equal "$output" '"max-length-test"' +>=20=20 +> test_begin_subtest "filename #9" +> output=3D$(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"' +>=20=20 +> # test notmuch-wash-subject-to-patch-filename (subject) +> test_begin_subtest "patch filename #1" +> --=20 +> 1.7.10.4 +> +> _______________________________________________ +> notmuch mailing list +> notmuch@notmuchmail.org +> http://notmuchmail.org/mailman/listinfo/notmuch -- 2.26.2