[PATCH 04/25] test: move "Search for non-existent message prints nothing" to search-output, and add similar test for format=json

Jameson Graef Rollins jrollins at finestructure.net
Sat May 28 14:51:39 PDT 2011


These tests also use the new test_expect_equal_file test.
---
 test/search        |    5 -----
 test/search-output |   12 ++++++++++++
 2 files changed, 12 insertions(+), 5 deletions(-)

diff --git a/test/search b/test/search
index 0981f66..4835872 100755
--- a/test/search
+++ b/test/search
@@ -118,9 +118,4 @@ 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
diff --git a/test/search-output b/test/search-output
index 1554eb1..8ba8acf 100755
--- a/test/search-output
+++ b/test/search-output
@@ -304,4 +304,16 @@ cat <<EOF >EXPECTED
 EOF
 test_expect_equal_file OUTPUT EXPECTED
 
+test_begin_subtest "notmuch search for non-existent message prints nothing"
+notmuch search "no-message-matches-this" > OUTPUT
+echo -n >EXPECTED
+test_expect_equal_file OUTPUT EXPECTED
+
+test_begin_subtest "notmuch search --format=json for non-existent message prints proper empty json"
+notmuch search --format=json "no-message-matches-this" > OUTPUT
+cat <<EOF >EXPECTED
+[]
+EOF
+test_expect_equal_file OUTPUT EXPECTED
+
 test_done
-- 
1.7.4.4



More information about the notmuch mailing list