Re: [PATCH v4 01/16] add util/search-path.{c, h} to test for executables in $PATH
[notmuch-archives.git] / b8 / 26b11494bd79f77d735c70b1f6926977de8b13
1 Return-Path: <bremner@tethera.net>\r
2 X-Original-To: notmuch@notmuchmail.org\r
3 Delivered-To: notmuch@notmuchmail.org\r
4 Received: from localhost (localhost [127.0.0.1])\r
5  by arlo.cworth.org (Postfix) with ESMTP id 5893F6DE1552\r
6  for <notmuch@notmuchmail.org>; Sat,  9 Jan 2016 18:52:29 -0800 (PST)\r
7 X-Virus-Scanned: Debian amavisd-new at cworth.org\r
8 X-Spam-Flag: NO\r
9 X-Spam-Score: -0.312\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=-0.312 tagged_above=-999 required=5 tests=[AWL=0.239,\r
12   RP_MATCHES_RCVD=-0.55, SPF_PASS=-0.001] autolearn=disabled\r
13 Received: from arlo.cworth.org ([127.0.0.1])\r
14  by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024)\r
15  with ESMTP id MSgeUzXrL83N for <notmuch@notmuchmail.org>;\r
16  Sat,  9 Jan 2016 18:52:26 -0800 (PST)\r
17 Received: from fethera.tethera.net (fethera.tethera.net [198.245.60.197])\r
18  by arlo.cworth.org (Postfix) with ESMTPS id CE2286DE1532\r
19  for <notmuch@notmuchmail.org>; Sat,  9 Jan 2016 18:51:59 -0800 (PST)\r
20 Received: from remotemail by fethera.tethera.net with local (Exim 4.84)\r
21  (envelope-from <bremner@tethera.net>)\r
22  id 1aI66g-0007EF-AC; Sat, 09 Jan 2016 21:51:50 -0500\r
23 Received: (nullmailer pid 29652 invoked by uid 1000);\r
24  Sun, 10 Jan 2016 02:51:47 -0000\r
25 From: David Bremner <david@tethera.net>\r
26 To: notmuch@notmuchmail.org\r
27 Subject: [WIP patch 5/9] lib: add notmuch_metadata_move_to_next\r
28 Date: Sat,  9 Jan 2016 22:51:37 -0400\r
29 Message-Id: <1452394301-29499-6-git-send-email-david@tethera.net>\r
30 X-Mailer: git-send-email 2.6.4\r
31 In-Reply-To: <1452394301-29499-1-git-send-email-david@tethera.net>\r
32 References: <1452394301-29499-1-git-send-email-david@tethera.net>\r
33 X-BeenThere: notmuch@notmuchmail.org\r
34 X-Mailman-Version: 2.1.20\r
35 Precedence: list\r
36 List-Id: "Use and development of the notmuch mail system."\r
37  <notmuch.notmuchmail.org>\r
38 List-Unsubscribe: <https://notmuchmail.org/mailman/options/notmuch>,\r
39  <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
40 List-Archive: <http://notmuchmail.org/pipermail/notmuch/>\r
41 List-Post: <mailto:notmuch@notmuchmail.org>\r
42 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
43 List-Subscribe: <https://notmuchmail.org/mailman/listinfo/notmuch>,\r
44  <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
45 X-List-Received-Date: Sun, 10 Jan 2016 02:52:29 -0000\r
46 \r
47 ---\r
48  lib/metadata.cc       |  6 ++++++\r
49  lib/notmuch.h         |  6 ++++++\r
50  test/T590-metadata.sh | 12 +++++++-----\r
51  3 files changed, 19 insertions(+), 5 deletions(-)\r
52 \r
53 diff --git a/lib/metadata.cc b/lib/metadata.cc\r
54 index 6236992..a355b75 100644\r
55 --- a/lib/metadata.cc\r
56 +++ b/lib/metadata.cc\r
57 @@ -239,3 +239,9 @@ notmuch_metadata_value (notmuch_metadata_t *metadata)\r
58  \r
59      return val;\r
60  }\r
61 +\r
62 +void\r
63 +notmuch_metadata_move_to_next (notmuch_metadata_t *metadata)\r
64 +{\r
65 +    (*(metadata->iterator))++;\r
66 +}\r
67 diff --git a/lib/notmuch.h b/lib/notmuch.h\r
68 index dd359c8..b00126d 100644\r
69 --- a/lib/notmuch.h\r
70 +++ b/lib/notmuch.h\r
71 @@ -1879,6 +1879,12 @@ notmuch_metadata_key (notmuch_metadata_t *metadata);\r
72  const char *\r
73  notmuch_metadata_value (notmuch_metadata_t *metadata);\r
74  \r
75 +/**\r
76 + * move 'metadata' iterator to the next pair\r
77 + */\r
78 +void\r
79 +notmuch_metadata_move_to_next (notmuch_metadata_t *metadata);\r
80 +\r
81  /* @} */\r
82  \r
83  NOTMUCH_END_DECLS\r
84 diff --git a/test/T590-metadata.sh b/test/T590-metadata.sh\r
85 index d2326d4..4f37c09 100755\r
86 --- a/test/T590-metadata.sh\r
87 +++ b/test/T590-metadata.sh\r
88 @@ -55,21 +55,23 @@ testkey2 = testvalue2\r
89  EOF\r
90  test_expect_equal_file EXPECTED OUTPUT\r
91  \r
92 -test_begin_subtest "notmuch_database_get_all_metadata first item"\r
93 +test_begin_subtest "get all metadata in one class"\r
94  cat c_head - c_tail <<'EOF' | test_C ${MAIL_DIR}\r
95  {\r
96     notmuch_metadata_t *meta;\r
97     RUN(notmuch_database_get_all_metadata (db, NOTMUCH_METADATA_CONFIG, &meta));\r
98 -   printf("valid = %d\n", notmuch_metadata_valid (meta));\r
99 -   printf("key = %s\n", notmuch_metadata_key (meta));\r
100 -   printf("val = %s\n", notmuch_metadata_value (meta));\r
101 +   for (; notmuch_metadata_valid (meta); notmuch_metadata_move_to_next (meta)) {\r
102 +      printf("key = %s\n", notmuch_metadata_key (meta));\r
103 +      printf("val = %s\n", notmuch_metadata_value (meta));\r
104 +   }\r
105  }\r
106  EOF\r
107  cat <<'EOF' >EXPECTED\r
108  == stdout ==\r
109 -valid = 1\r
110  key = testkey1\r
111  val = testvalue1\r
112 +key = testkey2\r
113 +val = testvalue2\r
114  == stderr ==\r
115  EOF\r
116  test_expect_equal_file EXPECTED OUTPUT\r
117 -- \r
118 2.6.4\r
119 \r