aboutsummaryrefslogtreecommitdiffhomepage
path: root/test
diff options
context:
space:
mode:
authorGravatar Jameson Graef Rollins <jrollins@finestructure.net>2011-05-06 11:57:16 -0700
committerGravatar Carl Worth <cworth@cworth.org>2011-06-01 16:31:52 -0700
commit7a453716c27f09063e0bda56b9ba1d6b2cdd17b5 (patch)
tree74aa0602dbf41bdfe390afeee3a749f2e0eda9f9 /test
parent049ac914f9041df54bfdbcb43f9356c4e74c1279 (diff)
test: Move a test from search to search-output, and add a similar json test
The "Search for non-existent message prints nothing" test fits better with the existing tests in search-output, so move it there. Also add a similar test for the --format=json case. These tests also use the new test_expect_equal_file function, (to ensure that the presence of a trailing newline is correctly tested).
Diffstat (limited to 'test')
-rwxr-xr-xtest/search5
-rwxr-xr-xtest/search-output12
2 files changed, 12 insertions, 5 deletions
diff --git a/test/search b/test/search
index 0981f66d..48358729 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 1554eb1e..8ba8acf7 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