2010-12-01 21:27:52 +01:00
|
|
|
#!/usr/bin/env bash
|
2010-06-10 08:48:03 +02:00
|
|
|
test_description="\"notmuch dump\" and \"notmuch restore\""
|
|
|
|
. ./test-lib.sh
|
|
|
|
|
2010-09-21 01:40:35 +02:00
|
|
|
add_email_corpus
|
|
|
|
|
2010-09-18 00:25:39 +02:00
|
|
|
test_expect_success "Dumping all tags" "generate_message &&
|
|
|
|
notmuch new &&
|
2011-10-09 15:29:22 +02:00
|
|
|
notmuch dump > dump.expected"
|
2010-09-18 00:25:39 +02:00
|
|
|
|
2011-10-10 14:27:20 +02:00
|
|
|
test_begin_subtest "dump outfile"
|
|
|
|
notmuch dump dump-outfile.actual
|
|
|
|
test_expect_equal_file dump.expected dump-outfile.actual
|
|
|
|
|
2011-10-10 15:44:07 +02:00
|
|
|
test_begin_subtest "dump outfile # deprecated"
|
|
|
|
test_expect_equal "Warning: the output file argument of dump is deprecated."\
|
|
|
|
"$(notmuch dump /dev/null 2>&1)"
|
|
|
|
|
2011-10-10 14:27:20 +02:00
|
|
|
test_begin_subtest "dump outfile --"
|
|
|
|
notmuch dump dump-1-arg-dash.actual --
|
|
|
|
test_expect_equal_file dump.expected dump-1-arg-dash.actual
|
|
|
|
|
|
|
|
# Note, we assume all messages from cworth have a message-id
|
|
|
|
# containing cworth.org
|
|
|
|
|
|
|
|
grep cworth\.org dump.expected > dump-cworth.expected
|
|
|
|
|
|
|
|
test_begin_subtest "dump -- from:cworth"
|
|
|
|
notmuch dump -- from:cworth > dump-dash-cworth.actual
|
|
|
|
test_expect_equal_file dump-cworth.expected dump-dash-cworth.actual
|
|
|
|
|
|
|
|
test_begin_subtest "dump outfile from:cworth"
|
|
|
|
notmuch dump dump-outfile-cworth.actual from:cworth
|
|
|
|
test_expect_equal_file dump-cworth.expected dump-outfile-cworth.actual
|
|
|
|
|
|
|
|
test_begin_subtest "dump outfile -- from:cworth"
|
|
|
|
notmuch dump dump-outfile-dash-inbox.actual -- from:cworth
|
|
|
|
test_expect_equal_file dump-cworth.expected dump-outfile-dash-inbox.actual
|
|
|
|
|
2010-09-18 00:25:39 +02:00
|
|
|
test_begin_subtest "Clearing all tags"
|
2010-06-10 08:48:03 +02:00
|
|
|
sed -e "s/(\([^(]*\))$/()/" < dump.expected > clear.expected
|
2011-10-09 15:29:22 +02:00
|
|
|
notmuch restore < clear.expected
|
|
|
|
notmuch dump > clear.actual
|
2010-09-18 00:25:39 +02:00
|
|
|
test_expect_equal "$(< clear.actual)" "$(< clear.expected)"
|
|
|
|
|
|
|
|
test_begin_subtest "Restoring original tags"
|
2011-10-09 15:29:22 +02:00
|
|
|
notmuch restore < dump.expected
|
|
|
|
notmuch dump > dump.actual
|
2010-09-18 00:25:39 +02:00
|
|
|
test_expect_equal "$(< dump.actual)" "$(< dump.expected)"
|
2010-06-10 08:48:03 +02:00
|
|
|
|
2010-09-21 01:13:15 +02:00
|
|
|
test_expect_success "Restore with nothing to do" "notmuch restore dump.expected"
|
2010-06-10 08:48:03 +02:00
|
|
|
|
|
|
|
test_done
|