aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Austin Clements <amdragon@MIT.EDU>2011-11-07 22:57:11 -0500
committerGravatar David Bremner <bremner@debian.org>2011-11-14 21:21:22 -0400
commited20210b6db0b237d48765351cb99b87be7a0509 (patch)
tree2cf65cf3d946e4999e413651d819da7e39a5eaa9
parent7a306e12c86ce0e419c91a20dd4ff79a27e89233 (diff)
test: Add a test script for "notmuch tag"
-rwxr-xr-xtest/notmuch-test1
-rwxr-xr-xtest/tagging41
2 files changed, 42 insertions, 0 deletions
diff --git a/test/notmuch-test b/test/notmuch-test
index 738f8f64..bbabf288 100755
--- a/test/notmuch-test
+++ b/test/notmuch-test
@@ -24,6 +24,7 @@ TESTS="
search-by-folder
search-position-overlap-bug
search-insufficient-from-quoting
+ tagging
json
multipart
thread-naming
diff --git a/test/tagging b/test/tagging
new file mode 100755
index 00000000..77202bf9
--- /dev/null
+++ b/test/tagging
@@ -0,0 +1,41 @@
+#!/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_done