Re: [notmuch] A functional (but rudimentary) test suite for notmuch

Subject: Re: [notmuch] A functional (but rudimentary) test suite for notmuch

Date: Thu, 11 Feb 2010 13:42:08 -0800

To: Michal Sojka, notmuch@notmuchmail.org

Cc:

From: Carl Worth


Hi Michal,

I found myself today *really* needing to add a test that exercises some
code in our emacs client. (Eric found that a message that includes a ":"
in the From: address breaks things due to a buggy regexp.) And I
wanted to see if I could merge your conversion of the test suite before
I added a feature as big as that. See below for my feedback.

-Carl

On Mon, 8 Feb 2010 16:14:24 +0100, Michal Sojka <sojkam1@fel.cvut.cz> wrote:
> I converted the actual version of notmuch-test to git test framework.
> The result is in the followup patches.

Interesting. My only real concern at this point is that some of the new files
have a copyright header identifying Junio as the copyright holder, but
no license information. Meanwhile, the implicit license of git (GPLv2
only) is incompatible with that of notmuch (GPLv3+).

So if you'd like to ask Junio for permission to re-use the files under
the GPLv3+ then we could see what he says.

In the meantime, you've done some nice modularization work here which we
should be able to take right away, (and I can write tiny implementations
of the functions we need so that we can just drop in git's test-lib.sh
if we get permission).

So we won't yet have any of the fancy features of the framework,
(expected failures, reports of fixed tests, pre-requisites for tests),
but we're not *using* any of those features yet so it shouldn't matter.

> The conversion was not as straightforward as I expected mainly because
> of problems with quoting. There are several sources of quotation problems
> one being Carl's hashed array parameters. I thing it would be
> sufficient to use plain variables for passing additional parameters.
> Instead of:
>     add_message [from]="\"Sender <sender@example.com>\"" \
>                 [to]=test_suite@notmuchmail.org \
...
> I'd do:
>     msg_from="Sender <sender@example.com>"
>     msg_to=test_suite@notmuchmail.org 
>     add_message

Yeah. I almost wrote it that way, but named parameters (even if faked)
seemed so much nicer. I'll agree that the quoting was quite nasty
though.

> A possible additional improvement is elimination of
> execute_expecting(). Combination of action (running notmuch) and
> testing of a result in a single function makes it hard to distinguish
> whether the problem is in the action or in the output.

A fair point. It also caused problems when I wanted to do tests that
didn't directly test the output of notmuch, (such as a test that uses
diff to compare a result against the contents in a file).

-Carl
part-000.sig (application/pgp-signature)

Thread: