From 0b1ddc5f6652bde99d63d9d553777b3d926694cf Mon Sep 17 00:00:00 2001 From: Carl Worth Date: Mon, 31 Jan 2011 05:26:04 +1000 Subject: json: Fix search result with no matches to be a valid json object. In the original json code, search matching nothing would return a valid, empty json array (that is, "[]"). I broke this in commit 6dcb7592e32ed5140ea0c0357ce78d6a37af6066 when adding support for --output=threads|messages|tags. This time, while fixing the bug also add a test to the test suite to help avoid future regressions. --- test/json | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'test') diff --git a/test/json b/test/json index 7fe2a27a..307cd1e6 100755 --- a/test/json +++ b/test/json @@ -39,4 +39,8 @@ test_expect_equal "$output" "[{\"thread\": \"XXX\", \"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 -- cgit v1.2.3