X-Git-Url: https://git.notmuchmail.org/git?p=notmuch;a=blobdiff_plain;f=test%2FT570-revision-tracking.sh;h=a59e7c980fc97c7c0fb4658cfe616da63d5a9e15;hp=e0a57030f404249308bb7a1b17a33b49f10f91c8;hb=4b1a8fd18364a6e1f1a6e987c64aae760505999e;hpb=98ee460eaa98f1428aecf03dd39fcf314e6f62c0 diff --git a/test/T570-revision-tracking.sh b/test/T570-revision-tracking.sh index e0a57030..a59e7c98 100755 --- a/test/T570-revision-tracking.sh +++ b/test/T570-revision-tracking.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash test_description="database revision tracking" -. ./test-lib.sh || exit 1 +. $(dirname "$0")/test-lib.sh || exit 1 add_email_corpus @@ -34,4 +34,60 @@ UUID 53 EOF test_expect_equal_file EXPECTED CLEAN +grep '^[0-9a-f]' OUTPUT > INITIAL_OUTPUT + +test_begin_subtest "output of count matches test code" +notmuch count --lastmod '*' | cut -f2-3 > OUTPUT +test_expect_equal_file INITIAL_OUTPUT OUTPUT + +test_begin_subtest "modification count increases" +before=$(notmuch count --lastmod '*' | cut -f3) +notmuch tag +a-random-tag-8743632 '*' +after=$(notmuch count --lastmod '*' | cut -f3) +result=$(($before < $after)) +test_expect_equal 1 ${result} + +notmuch count --lastmod '*' | cut -f2 > UUID + +test_begin_subtest "search succeeds with correct uuid" +test_expect_success "notmuch search --uuid=$(cat UUID) '*'" + +test_begin_subtest "uuid works as global option" +test_expect_success "notmuch --uuid=$(cat UUID) search '*'" + +test_begin_subtest "uuid works as global option II" +test_expect_code 1 "notmuch --uuid=this-is-no-uuid search '*'" + +test_begin_subtest "search fails with incorrect uuid" +test_expect_code 1 "notmuch search --uuid=this-is-no-uuid '*'" + +test_begin_subtest "show succeeds with correct uuid" +test_expect_success "notmuch show --uuid=$(cat UUID) '*'" + +test_begin_subtest "show fails with incorrect uuid" +test_expect_code 1 "notmuch show --uuid=this-is-no-uuid '*'" + +test_begin_subtest "tag succeeds with correct uuid" +test_expect_success "notmuch tag --uuid=$(cat UUID) +test '*'" + +test_begin_subtest "tag fails with incorrect uuid" +test_expect_code 1 "notmuch tag --uuid=this-is-no-uuid '*' +test2" + +test_begin_subtest 'lastmod:0.. matches everything' +total=$(notmuch count '*') +modtotal=$(notmuch count lastmod:0..) +test_expect_equal "$total" "$modtotal" + +test_begin_subtest 'lastmod:1000000.. matches nothing' +modtotal=$(notmuch count lastmod:1000000..) +test_expect_equal 0 "$modtotal" + +test_begin_subtest 'exclude one message using lastmod' +lastmod=$(notmuch count --lastmod '*' | cut -f3) +total=$(notmuch count '*') +notmuch tag +4EFC743A.3060609@april.org id:4EFC743A.3060609@april.org +subtotal=$(notmuch count lastmod:..$lastmod) +result=$(($subtotal == $total-1)) +test_expect_equal 1 "$result" + test_done