[Patch v4 08/10] test/dump-restore: add test for warning/error messages

david at tethera.net david at tethera.net
Sat Dec 8 07:07:54 PST 2012


From: David Bremner <bremner at debian.org>

We want to test both that error/warning messages are generated when
they should be, and not generated when they should not be. This varies
between restore and batch tagging.
---
 test/dump-restore |   29 +++++++++++++++++++++++++++++
 1 file changed, 29 insertions(+)

diff --git a/test/dump-restore b/test/dump-restore
index 7d91cca..b267792 100755
--- a/test/dump-restore
+++ b/test/dump-restore
@@ -181,6 +181,35 @@ notmuch restore < EXPECTED.$test_count
 notmuch dump --format=sup > OUTPUT.$test_count
 test_expect_equal_file EXPECTED.$test_count OUTPUT.$test_count
 
+test_begin_subtest 'restore: checking error messages'
+notmuch restore <<EOF 2>OUTPUT
++a +b
++c +d --
+# this is a harmless comment, do not yell about it.
+
+# the previous line was blank; also no yelling please
++%zz -- id:whatever
++e +f id:%yy
+# the next line should report an an empty tag error for batch tagging, but restore
++ +e -- id:20091117232137.GA7669 at griffis1.net
+# highlight the sketchy id parsing; this should be last
++g -- id:foo and bar
+EOF
+
+cat <<EOF > EXPECTED
+Warning: no query string: +a +b
+Warning: Ignoring invalid input line +a +b
+Warning: no query string: +c +d --
+Warning: Ignoring invalid input line +c +d --
+Warning: Hex decoding of tag %zz failed
+Warning: Ignoring invalid input line +%zz -- id:whatever
+Warning: Hex decoding of query id:%yy failed
+Warning: Ignoring invalid input line +e +f id:%yy
+Warning: Cannot apply tags to missing message: foo and bar
+EOF
+
+test_expect_equal_file EXPECTED OUTPUT
+
 test_begin_subtest 'roundtripping random message-ids and tags'
 
     ${TEST_DIRECTORY}/random-corpus --config-path=${NOTMUCH_CONFIG} \
-- 
1.7.10.4



More information about the notmuch mailing list