X-Git-Url: https://git.cworth.org/git?a=blobdiff_plain;f=test%2FT035-read-config.sh;h=1e740eba35342c96116526b78c1479484d5ec097;hb=0ab0b48be2d76c2c9b5581c1b66b21934b2025b7;hp=38d6c609dca12e5f59f72d96dbb5eb5d72c03328;hpb=acc6331baa41a8aa7025924c823251d8f8c3384f;p=notmuch diff --git a/test/T035-read-config.sh b/test/T035-read-config.sh index 38d6c609..1e740eba 100755 --- a/test/T035-read-config.sh +++ b/test/T035-read-config.sh @@ -71,5 +71,143 @@ EOF restore_config test_expect_equal_file EXPECTED OUTPUT +cat < EXPECTED +Before: +#notmuch-dump batch-tag:3 tags + +After: +#notmuch-dump batch-tag:3 tags ++attachment +inbox +signed +unread -- id:20091118005829.GB25380@dottiness.seas.harvard.edu ++attachment +inbox +signed +unread -- id:20091118010116.GC25380@dottiness.seas.harvard.edu ++inbox +signed +unread -- id:20091117190054.GU3165@dottiness.seas.harvard.edu ++inbox +signed +unread -- id:20091117203301.GV3165@dottiness.seas.harvard.edu ++inbox +signed +unread -- id:20091118002059.067214ed@hikari ++inbox +signed +unread -- id:20091118005040.GA25380@dottiness.seas.harvard.edu ++inbox +signed +unread -- id:87iqd9rn3l.fsf@vertex.dottedmag +EOF + +test_begin_subtest "dump with saved query from config file" +backup_config +query_name="test${RANDOM}" +CONFIG_PATH=notmuch-config +printf "Before:\n" > OUTPUT +notmuch dump --include=tags query:$query_name | sort >> OUTPUT +printf "\nAfter:\n" >> OUTPUT +printf "\n[query]\n${query_name} = tag:signed\n" >> ${CONFIG_PATH} +notmuch dump --include=tags query:$query_name | sort >> OUTPUT +restore_config +test_expect_equal_file EXPECTED OUTPUT + +test_begin_subtest "dump with saved query from config file (xdg)" +backup_config +query_name="test${RANDOM}" +xdg_config +printf "Before:\n" > OUTPUT +notmuch dump --include=tags query:$query_name | sort >> OUTPUT +printf "\nAfter:\n" >> OUTPUT +printf "\n[query]\n${query_name} = tag:signed\n" >> ${CONFIG_PATH} +notmuch dump --include=tags query:$query_name | sort >> OUTPUT +restore_config +test_expect_equal_file EXPECTED OUTPUT + +test_begin_subtest "dump with saved query from config file (xdg+profile)" +backup_config +query_name="test${RANDOM}" +xdg_config work +printf "Before:\n" > OUTPUT +notmuch dump --include=tags query:$query_name | sort >> OUTPUT +printf "\nAfter:\n" >> OUTPUT +printf "\n[query]\n${query_name} = tag:signed\n" >> ${CONFIG_PATH} +notmuch dump --include=tags query:$query_name | sort >> OUTPUT +restore_config +test_expect_equal_file EXPECTED OUTPUT + +test_begin_subtest "restore with xdg config" +backup_config +notmuch dump '*' > EXPECTED +notmuch tag -inbox '*' +xdg_config +notmuch restore --input=EXPECTED +notmuch dump > OUTPUT +restore_config +test_expect_equal_file EXPECTED OUTPUT + +test_begin_subtest "restore with xdg+profile config" +backup_config +notmuch dump '*' > EXPECTED +notmuch tag -inbox '*' +xdg_config work +notmuch restore --input=EXPECTED +notmuch dump > OUTPUT +restore_config +test_expect_equal_file EXPECTED OUTPUT + +test_begin_subtest "Insert message with custom new.tags (xdg)" +backup_config +xdg_config +tag=test${RANDOM} +notmuch --config=${CONFIG_PATH} config set new.tags $tag +generate_message \ + "[subject]=\"insert-subject\"" \ + "[date]=\"Sat, 01 Jan 2000 12:00:00 -0000\"" \ + "[body]=\"insert-message\"" +mkdir -p ${MAIL_DIR}/{cur,new,tmp} +notmuch insert < "$gen_msg_filename" +notmuch dump id:$gen_msg_id > OUTPUT +cat < EXPECTED +#notmuch-dump batch-tag:3 config,properties,tags ++$tag -- id:$gen_msg_id +EOF +restore_config +test_expect_equal_file EXPECTED OUTPUT + +test_begin_subtest "Insert message with custom new.tags (xdg+profile)" +backup_config +tag=test${RANDOM} +xdg_config $tag +notmuch --config=${CONFIG_PATH} config set new.tags $tag +generate_message \ + "[subject]=\"insert-subject\"" \ + "[date]=\"Sat, 01 Jan 2000 12:00:00 -0000\"" \ + "[body]=\"insert-message\"" +mkdir -p ${MAIL_DIR}/{cur,new,tmp} +notmuch insert < "$gen_msg_filename" +notmuch dump id:$gen_msg_id > OUTPUT +cat < EXPECTED +#notmuch-dump batch-tag:3 config,properties,tags ++$tag -- id:$gen_msg_id +EOF +restore_config +test_expect_equal_file EXPECTED OUTPUT + +test_begin_subtest "reindex with saved query from config file" +backup_config +query_name="test${RANDOM}" +count1=$(notmuch count --lastmod '*' | cut -f3) +printf "\n[query]\n${query_name} = tag:inbox\n" >> notmuch-config +notmuch reindex query:$query_name +count2=$(notmuch count --lastmod '*' | cut -f3) +restore_config +test_expect_success "test '$count2 -gt $count1'" + +test_begin_subtest "reindex with saved query from config file (xdg)" +query_name="test${RANDOM}" +count1=$(notmuch count --lastmod '*' | cut -f3) +xdg_config +printf "\n[query]\n${query_name} = tag:inbox\n" >> ${CONFIG_PATH} +notmuch reindex query:$query_name +count2=$(notmuch count --lastmod '*' | cut -f3) +restore_config +test_expect_success "test '$count2 -gt $count1'" + +test_begin_subtest "reindex with saved query from config file (xdg+profile)" +query_name="test${RANDOM}" +count1=$(notmuch count --lastmod '*' | cut -f3) +xdg_config $query_name +printf "\n[query]\n${query_name} = tag:inbox\n" >> ${CONFIG_PATH} +notmuch reindex query:$query_name +count2=$(notmuch count --lastmod '*' | cut -f3) +restore_config +test_expect_success "test '$count2 -gt $count1'" test_done