2 test_description="\"notmuch dump\" and \"notmuch restore\""
7 test_expect_success 'Dumping all tags' \
10 notmuch dump > dump.expected'
12 test_expect_success 'Clearing all tags' \
13 'sed -e "s/(\([^(]*\))$/()/" < dump.expected > clear.expected &&
14 notmuch restore clear.expected &&
15 notmuch dump > clear.actual &&
16 test_cmp clear.expected clear.actual'
18 test_expect_success 'Restoring original tags' \
19 'notmuch restore dump.expected &&
20 notmuch dump > dump.actual &&
21 test_cmp dump.expected dump.actual'
23 test_expect_success 'Restore with nothing to do' \
24 'notmuch restore < dump.expected &&
25 notmuch dump > dump.actual &&
26 test_cmp dump.expected dump.actual'
28 # notmuch restore currently only considers the first argument.
29 test_subtest_known_broken
30 test_expect_success 'Invalid restore invocation' \
31 'test_must_fail notmuch restore dump.expected another_one'
33 test_begin_subtest "dump outfile"
34 notmuch dump dump-outfile.actual
35 test_expect_equal_file dump.expected dump-outfile.actual
37 test_begin_subtest "dump outfile # deprecated"
38 test_expect_equal "Warning: the output file argument of dump is deprecated."\
39 "$(notmuch dump /dev/null 2>&1)"
41 test_begin_subtest "dump outfile --"
42 notmuch dump dump-1-arg-dash.actual --
43 test_expect_equal_file dump.expected dump-1-arg-dash.actual
45 # Note, we assume all messages from cworth have a message-id
46 # containing cworth.org
48 grep cworth\.org dump.expected > dump-cworth.expected
50 test_begin_subtest "dump -- from:cworth"
51 notmuch dump -- from:cworth > dump-dash-cworth.actual
52 test_expect_equal_file dump-cworth.expected dump-dash-cworth.actual
54 test_begin_subtest "dump outfile from:cworth"
55 notmuch dump dump-outfile-cworth.actual from:cworth
56 test_expect_equal_file dump-cworth.expected dump-outfile-cworth.actual
58 test_begin_subtest "dump outfile -- from:cworth"
59 notmuch dump dump-outfile-dash-inbox.actual -- from:cworth
60 test_expect_equal_file dump-cworth.expected dump-outfile-dash-inbox.actual