]> git.cworth.org Git - notmuch/commitdiff
test: Search for non-existent message should return nothing
authorMichal Sojka <sojkam1@fel.cvut.cz>
Mon, 1 Nov 2010 16:15:39 +0000 (17:15 +0100)
committerCarl Worth <cworth@cworth.org>
Thu, 4 Nov 2010 19:34:33 +0000 (12:34 -0700)
My scripts expect that empty search result is actually empty. Since
commit 6dcb7592, even empty search prints a newline character and this
breaks my scripts.

This patch adds a test for this bug. In the test I cannot use
test_expect_equal function as $() operator suppresses the final
newline and this kind of difference is not detected.

 test/search |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

test/search

index 91325552995ccb8100e968e6bf0272cacf4be162..5939c6aa4a02df36e40f021d8d8ff9fe9061c9fd 100755 (executable)
@@ -96,4 +96,9 @@ add_message '[subject]="utf8-message-body-subject"' '[date]="Sat, 01 Jan 2000 12
 output=$(notmuch search "bödý" | notmuch_search_sanitize)
 test_expect_equal "$output" "thread:XXX   2000-01-01 [1/1] Notmuch Test Suite; utf8-message-body-subject (inbox unread)"
 
+test_expect_success "Search for non-existent message prints nothing" '
+echo -n > expected &&
+notmuch search "no-message-matches-this" > actual &&
+test_cmp expected actual'
+
 test_done