2 test_description="\"notmuch dump\" and \"notmuch restore\""
7 test_expect_success "Dumping all tags" "generate_message &&
9 notmuch dump > dump.expected"
11 test_begin_subtest "dump outfile"
12 notmuch dump dump-outfile.actual
13 test_expect_equal_file dump.expected dump-outfile.actual
15 test_begin_subtest "dump outfile --"
16 notmuch dump dump-1-arg-dash.actual --
17 test_expect_equal_file dump.expected dump-1-arg-dash.actual
19 # Note, we assume all messages from cworth have a message-id
20 # containing cworth.org
22 grep cworth\.org dump.expected > dump-cworth.expected
24 test_begin_subtest "dump -- from:cworth"
25 notmuch dump -- from:cworth > dump-dash-cworth.actual
26 test_expect_equal_file dump-cworth.expected dump-dash-cworth.actual
28 test_begin_subtest "dump outfile from:cworth"
29 notmuch dump dump-outfile-cworth.actual from:cworth
30 test_expect_equal_file dump-cworth.expected dump-outfile-cworth.actual
32 test_begin_subtest "dump outfile -- from:cworth"
33 notmuch dump dump-outfile-dash-inbox.actual -- from:cworth
34 test_expect_equal_file dump-cworth.expected dump-outfile-dash-inbox.actual
36 test_begin_subtest "Clearing all tags"
37 sed -e "s/(\([^(]*\))$/()/" < dump.expected > clear.expected
38 notmuch restore < clear.expected
39 notmuch dump > clear.actual
40 test_expect_equal "$(< clear.actual)" "$(< clear.expected)"
42 test_begin_subtest "Restoring original tags"
43 notmuch restore < dump.expected
44 notmuch dump > dump.actual
45 test_expect_equal "$(< dump.actual)" "$(< dump.expected)"
47 test_expect_success "Restore with nothing to do" "notmuch restore dump.expected"