mirror of
https://git.notmuchmail.org/git/notmuch
synced 2024-11-25 20:38:08 +01:00
e0a223d156
This disallows adding empty tags, since nothing but confusion follows in their wake, and disallows adding tags that begin with "-" because they are also confusing, the tag "-" is impossible to remove using the CLI, and because the syntax for removing such tags conflicts with long argument syntax. This does not place any restrictions on what tags can be removed, as that would make it difficult for people who have the misfortune of already having malformed tags to remove these tags.
53 lines
1.9 KiB
Bash
Executable file
53 lines
1.9 KiB
Bash
Executable file
#!/usr/bin/env bash
|
|
test_description='"notmuch tag"'
|
|
. ./test-lib.sh
|
|
|
|
add_message '[subject]=One'
|
|
add_message '[subject]=Two'
|
|
|
|
test_begin_subtest "Adding tags"
|
|
notmuch tag +tag1 +tag2 +tag3 \*
|
|
output=$(notmuch search \* | notmuch_search_sanitize)
|
|
test_expect_equal "$output" "\
|
|
thread:XXX 2001-01-05 [1/1] Notmuch Test Suite; One (inbox tag1 tag2 tag3 unread)
|
|
thread:XXX 2001-01-05 [1/1] Notmuch Test Suite; Two (inbox tag1 tag2 tag3 unread)"
|
|
|
|
test_begin_subtest "Removing tags"
|
|
notmuch tag -tag1 -tag2 \*
|
|
output=$(notmuch search \* | notmuch_search_sanitize)
|
|
test_expect_equal "$output" "\
|
|
thread:XXX 2001-01-05 [1/1] Notmuch Test Suite; One (inbox tag3 unread)
|
|
thread:XXX 2001-01-05 [1/1] Notmuch Test Suite; Two (inbox tag3 unread)"
|
|
|
|
test_expect_code 1 "No tag operations" 'notmuch tag One'
|
|
test_expect_code 1 "No query" 'notmuch tag +tag2'
|
|
|
|
test_begin_subtest "Redundant tagging"
|
|
notmuch tag +tag1 -tag3 One
|
|
notmuch tag +tag1 -tag3 \*
|
|
output=$(notmuch search \* | notmuch_search_sanitize)
|
|
test_expect_equal "$output" "\
|
|
thread:XXX 2001-01-05 [1/1] Notmuch Test Suite; One (inbox tag1 unread)
|
|
thread:XXX 2001-01-05 [1/1] Notmuch Test Suite; Two (inbox tag1 unread)"
|
|
|
|
test_begin_subtest "Special characters in tags"
|
|
notmuch tag +':" ' \*
|
|
notmuch tag -':" ' Two
|
|
output=$(notmuch search \* | notmuch_search_sanitize)
|
|
test_expect_equal "$output" "\
|
|
thread:XXX 2001-01-05 [1/1] Notmuch Test Suite; One (:\" inbox tag1 unread)
|
|
thread:XXX 2001-01-05 [1/1] Notmuch Test Suite; Two (inbox tag1 unread)"
|
|
|
|
test_begin_subtest "Tagging order"
|
|
notmuch tag +tag4 -tag4 One
|
|
notmuch tag -tag4 +tag4 Two
|
|
output=$(notmuch search \* | notmuch_search_sanitize)
|
|
test_expect_equal "$output" "\
|
|
thread:XXX 2001-01-05 [1/1] Notmuch Test Suite; One (:\" inbox tag1 unread)
|
|
thread:XXX 2001-01-05 [1/1] Notmuch Test Suite; Two (inbox tag1 tag4 unread)"
|
|
|
|
test_expect_code 1 "Empty tag names" 'notmuch tag + One'
|
|
|
|
test_expect_code 1 "Tag name beginning with -" 'notmuch tag +- One'
|
|
|
|
test_done
|