]> git.cworth.org Git - obsolete/notmuch-old/commitdiff
test: Add tests for 'config' command
authorPeter Wang <novalazy@gmail.com>
Sat, 14 Apr 2012 01:41:03 +0000 (11:41 +1000)
committerDavid Bremner <bremner@debian.org>
Sat, 28 Apr 2012 13:14:10 +0000 (10:14 -0300)
Start a new test script.

test/config [new file with mode: 0755]
test/notmuch-test

diff --git a/test/config b/test/config
new file mode 100755 (executable)
index 0000000..9030154
--- /dev/null
@@ -0,0 +1,45 @@
+#!/usr/bin/env bash
+
+test_description='"notmuch config"'
+. test-lib.sh
+
+test_begin_subtest "Get string value"
+test_expect_equal "$(notmuch config get user.name)" "Notmuch Test Suite"
+
+test_begin_subtest "Get list value"
+test_expect_equal "$(notmuch config get new.tags)" "\
+unread
+inbox"
+
+test_begin_subtest "Set string value"
+notmuch config set foo.string "this is a string value"
+test_expect_equal "$(notmuch config get foo.string)" "this is a string value"
+
+test_begin_subtest "Set string value again"
+notmuch config set foo.string "this is another string value"
+test_expect_equal "$(notmuch config get foo.string)" "this is another string value"
+
+test_begin_subtest "Set list value"
+notmuch config set foo.list this "is a" "list value"
+test_expect_equal "$(notmuch config get foo.list)" "\
+this
+is a
+list value"
+
+test_begin_subtest "Set list value again"
+notmuch config set foo.list this "is another" "list value"
+test_expect_equal "$(notmuch config get foo.list)" "\
+this
+is another
+list value"
+
+test_begin_subtest "Remove key"
+notmuch config set foo.remove baz
+notmuch config set foo.remove
+test_expect_equal "$(notmuch config get foo.remove)" ""
+
+test_begin_subtest "Remove non-existent key"
+notmuch config set foo.nonexistent
+test_expect_equal "$(notmuch config get foo.nonexistent)" ""
+
+test_done
index 801df732f176cc3f7e0cdfe9978921d70245dffc..bfad5d3c79d5b65a8d778190b8721bbf249aada7 100755 (executable)
@@ -19,6 +19,7 @@ cd $(dirname "$0")
 TESTS="
   basic
   help-test
+  config
   new
   count
   search