unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: Matt Armstrong <marmstrong@google.com>
To: David Bremner <david@tethera.net>, notmuch@notmuchmail.org
Subject: Re: [PATCH] lib/string_map: fix return type of string_cmp
Date: Tue, 05 Mar 2019 16:45:29 -0800	[thread overview]
Message-ID: <qf5k1hcbzkm.fsf@naz.kir.corp.google.com> (raw)
In-Reply-To: <87o96pglwa.fsf@tethera.net>

David Bremner <david@tethera.net> writes:

> Matt Armstrong <marmstrong@google.com> writes:
>
>> Perhaps some unit tests for _notmuch_string_map would be worthwhile?
>>
>
> Thanks for the feedback. At first I thought this would be too hard/intrusive,
> since the string_map functions are not exported, but I realized
> n_message_property_get is a thin wrapper on _notmuch_string_map_get, so
> I added the following test. Most of the searches fail before the patch.
>
> test_begin_subtest "testing string map binary search (via message properties)"
> cat c_head - c_tail <<'EOF' | test_C ${MAIL_DIR}
> {
>    char *keys[] = {"a", "b", "c", "d", "e", NULL};
>    for (int i=0; keys[i]; i++)
>        EXPECT0(notmuch_message_add_property (message, keys[i], keys[i]));
>
>    for (int i=0; keys[i]; i++) {
>       EXPECT0(notmuch_message_get_property (message, keys[i], &val));
>       printf("%s = %s\n", keys[i], val);
>    }
>
>    for (int i=0; keys[i]; i++)
>       EXPECT0(notmuch_message_remove_property (message, keys[i], keys[i]));
> }

Nice.  The test could even go further and verify that get_property fails
after the properties are removed.

      reply	other threads:[~2019-03-06  0:45 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-02 18:34 [PATCH] lib/string_map: fix return type of string_cmp David Bremner
2019-03-05  1:42 ` Matt Armstrong
2019-03-05 19:29   ` David Bremner
2019-03-06  0:45     ` Matt Armstrong [this message]

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=qf5k1hcbzkm.fsf@naz.kir.corp.google.com \
    --to=marmstrong@google.com \
    --cc=david@tethera.net \
    --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).