From: David Bremner <brem...@debian.org> These one need the completed functionality in notmuch-restore. Fairly exotic tags are tested, but no weird message id's.
We test each possible input to autodetection, both explicit (with --format=auto) and implicit (without --format). --- test/dump-restore | 66 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 66 insertions(+), 0 deletions(-) diff --git a/test/dump-restore b/test/dump-restore index 0e210d3..60ae68e 100755 --- a/test/dump-restore +++ b/test/dump-restore @@ -94,4 +94,70 @@ notmuch dump --format=sup -- from:cworth | tr -d \(\) > EXPECTED.$test_count notmuch dump --format=notmuch -- from:cworth > OUTPUT.$test_count test_expect_equal_file OUTPUT.$test_count EXPECTED.$test_count +test_begin_subtest "format=notmuch, # round-trip" +notmuch dump --format=sup | sort > EXPECTED.$test_count +notmuch dump --format=notmuch | notmuch restore --format=notmuch +notmuch dump --format=sup | sort > OUTPUT.$test_count +test_expect_equal_file EXPECTED.$test_count OUTPUT.$test_count + +tag1='comic_swear=$&^%$^%\\//-+$^%$' +enc1=$($TEST_DIRECTORY/hex-xcode --direction=encode "$tag1") + +tag2=$(printf 'this\n tag\t has\n spaces') +enc2=$($TEST_DIRECTORY/hex-xcode --direction=encode "$tag2") + +enc3='%c3%91%c3%a5%c3%b0%c3%a3%c3%a5%c3%a9-%c3%8f%c3%8a' +tag3=$($TEST_DIRECTORY/hex-xcode --direction=decode $enc3) + +notmuch dump --format=notmuch > BACKUP + +notmuch tag +"$tag1" +"$tag2" +"$tag3" -inbox -unread "*" + +test_begin_subtest 'format=notmuch, round trip with strange tags' + notmuch dump --format=notmuch > EXPECTED.$test_count + notmuch dump --format=notmuch | notmuch restore --format=notmuch + notmuch dump --format=notmuch > OUTPUT.$test_count +test_expect_equal_file EXPECTED.$test_count OUTPUT.$test_count + +test_begin_subtest 'format=notmuch, checking encoded output' + cp /dev/null EXPECTED.$test_count + notmuch dump --format=notmuch -- from:cworth |\ + awk "{ print \$1 \" $enc1 $enc2 $enc3\" }" > EXPECTED.$test_count + + notmuch dump --format=notmuch -- from:cworth > OUTPUT.$test_count +test_expect_equal_file EXPECTED.$test_count OUTPUT.$test_count + +test_begin_subtest 'restoring sane tags' + notmuch restore --format=notmuch < BACKUP + notmuch dump --format=notmuch > OUTPUT.$test_count +test_expect_equal_file BACKUP OUTPUT.$test_count + +test_begin_subtest 'format=notmuch, restore=auto' + notmuch dump --format=notmuch > EXPECTED.$test_count + notmuch tag -inbox -unread "*" + notmuch restore --format=auto < EXPECTED.$test_count + notmuch dump --format=notmuch > OUTPUT.$test_count +test_expect_equal_file EXPECTED.$test_count OUTPUT.$test_count + +test_begin_subtest 'format=sup, restore=auto' + notmuch dump --format=sup > EXPECTED.$test_count + notmuch tag -inbox -unread "*" + notmuch restore --format=auto < EXPECTED.$test_count + notmuch dump --format=sup > OUTPUT.$test_count +test_expect_equal_file EXPECTED.$test_count OUTPUT.$test_count + +test_begin_subtest 'format=notmuch, restore=default' + notmuch dump --format=notmuch > EXPECTED.$test_count + notmuch tag -inbox -unread "*" + notmuch restore < EXPECTED.$test_count + notmuch dump --format=notmuch > OUTPUT.$test_count +test_expect_equal_file EXPECTED.$test_count OUTPUT.$test_count + +test_begin_subtest 'format=sup, restore=default' + notmuch dump --format=sup > EXPECTED.$test_count + notmuch tag -inbox -unread "*" + notmuch restore < EXPECTED.$test_count + notmuch dump --format=sup > OUTPUT.$test_count +test_expect_equal_file EXPECTED.$test_count OUTPUT.$test_count + test_done -- 1.7.7.3 _______________________________________________ notmuch mailing list notmuch@notmuchmail.org http://notmuchmail.org/mailman/listinfo/notmuch