"%s", " ",
")", "\n",
"",
- "\n",
+ "",
};
static void
if (threads == NULL)
return 1;
+ fputs (format->results_start, stdout);
+
for (;
notmuch_threads_valid (threads);
notmuch_threads_move_to_next (threads))
{
int first_tag = 1;
- if (first_thread)
- fputs (format->results_start, stdout);
- else
+ if (! first_thread)
fputs (format->item_sep, stdout);
thread = notmuch_threads_get (threads);
notmuch_thread_destroy (thread);
}
- if (! first_thread)
- fputs (format->results_end, stdout);
+ fputs (format->results_end, stdout);
return 0;
}
if (messages == NULL)
return 1;
+ fputs (format->results_start, stdout);
+
for (;
notmuch_messages_valid (messages);
notmuch_messages_move_to_next (messages))
{
message = notmuch_messages_get (messages);
- if (first_message)
- fputs (format->results_start, stdout);
- else
+ if (! first_message)
fputs (format->item_sep, stdout);
if (output == OUTPUT_FILES) {
notmuch_messages_destroy (messages);
- if (! first_message)
- fputs (format->results_end, stdout);
+ fputs (format->results_end, stdout);
return 0;
}
if (tags == NULL)
return 1;
+ fputs (format->results_start, stdout);
+
for (;
notmuch_tags_valid (tags);
notmuch_tags_move_to_next (tags))
{
tag = notmuch_tags_get (tags);
- if (first_tag)
- fputs (format->results_start, stdout);
- else
+ if (! first_tag)
fputs (format->item_sep, stdout);
format->item_id (tags, "", tag);
if (messages)
notmuch_messages_destroy (messages);
- if (! first_tag)
- fputs (format->results_end, stdout);
+ fputs (format->results_end, stdout);
return 0;
}
\"subject\": \"json-search-utf8-body-sübjéct\",
\"tags\": [\"inbox\", \"unread\"]}]"
+test_begin_subtest "Search returning no messages"
+output=$(notmuch search --format=json "this string had better not match any messages" | notmuch_search_sanitize)
+test_expect_equal "$output" "[]"
+
test_done