From: David Bremner <david@tethera.net>
To: Matt Armstrong <marmstrong@google.com>, notmuch@notmuchmail.org
Subject: Re: [PATCH] lib/string_map: fix return type of string_cmp
Date: Tue, 05 Mar 2019 15:29:41 -0400 [thread overview]
Message-ID: <87o96pglwa.fsf@tethera.net> (raw)
In-Reply-To: <qf5k1heumeo.fsf@naz.kir.corp.google.com>
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]));
}
EOF
cat <<EOF > EXPECTED
== stdout ==
a = a
b = b
c = c
d = d
e = e
== stderr ==
EOF
test_expect_equal_file EXPECTED OUTPUT
next prev parent reply other threads:[~2019-03-05 19:29 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 [this message]
2019-03-06 0:45 ` Matt Armstrong
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=87o96pglwa.fsf@tethera.net \
--to=david@tethera.net \
--cc=marmstrong@google.com \
--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).