diff options
author | David Edmondson <dme@dme.org> | 2012-01-24 16:14:07 +0000 |
---|---|---|
committer | David Bremner <bremner@debian.org> | 2012-01-25 07:27:01 -0400 |
commit | 3699fedb3accf5fbd8085c0789d43c716d6ad3e9 (patch) | |
tree | 44a99420c4f9b02d423f9cea12d17e11d73b2047 /test | |
parent | f92d7dee8fcf399bda361df82187523598bb09b4 (diff) |
test: Add address cleaning tests.
Diffstat (limited to 'test')
-rw-r--r-- | test/emacs-address-cleaning.el | 29 | ||||
-rwxr-xr-x | test/emacs-address-cleaning.sh | 19 | ||||
-rwxr-xr-x | test/notmuch-test | 1 |
3 files changed, 49 insertions, 0 deletions
diff --git a/test/emacs-address-cleaning.el b/test/emacs-address-cleaning.el new file mode 100644 index 00000000..19e9e055 --- /dev/null +++ b/test/emacs-address-cleaning.el @@ -0,0 +1,29 @@ +(defun notmuch-test-address-cleaning-1 () + (notmuch-test-expect-equal (notmuch-show-clean-address "dme@dme.org") + "dme@dme.org")) + +(defun notmuch-test-address-cleaning-2 () + (let* ((input '("foo@bar.com" + "<foo@bar.com>" + "Foo Bar <foo@bar.com>" + "foo@bar.com <foo@bar.com>" + "\"Foo Bar\" <foo@bar.com>")) + (expected '("foo@bar.com" + "foo@bar.com" + "Foo Bar <foo@bar.com>" + "foo@bar.com" + "Foo Bar <foo@bar.com>")) + (output (mapcar #'notmuch-show-clean-address input))) + (notmuch-test-expect-equal output expected))) + +(defun notmuch-test-address-cleaning-3 () + (let* ((input '("ДБ <db-uknot@stop.me.uk>" + "foo (at home) <foo@bar.com>" + "foo [at home] <foo@bar.com>" + "Foo Bar")) + (expected '("ДБ <db-uknot@stop.me.uk>" + "foo (at home) <foo@bar.com>" + "foo [at home] <foo@bar.com>" + "Foo Bar")) + (output (mapcar #'notmuch-show-clean-address input))) + (notmuch-test-expect-equal output expected))) diff --git a/test/emacs-address-cleaning.sh b/test/emacs-address-cleaning.sh new file mode 100755 index 00000000..0d85bdc2 --- /dev/null +++ b/test/emacs-address-cleaning.sh @@ -0,0 +1,19 @@ +#!/usr/bin/env bash + +test_description="emacs address cleaning" +. test-lib.sh + +test_begin_subtest "notmuch-test-address-clean part 1" +test_emacs_expect_t \ + '(load "emacs-address-cleaning.el") (notmuch-test-address-cleaning-1)' + +test_begin_subtest "notmuch-test-address-clean part 2" +test_emacs_expect_t \ + '(load "emacs-address-cleaning.el") (notmuch-test-address-cleaning-2)' + +test_begin_subtest "notmuch-test-address-clean part 3" +test_subtest_known_broken +test_emacs_expect_t \ + '(load "emacs-address-cleaning.el") (notmuch-test-address-cleaning-3)' + +test_done diff --git a/test/notmuch-test b/test/notmuch-test index d034f997..3f1740cf 100755 --- a/test/notmuch-test +++ b/test/notmuch-test @@ -53,6 +53,7 @@ TESTS=" hooks argument-parsing emacs-test-functions.sh + emacs-address-cleaning.sh " TESTS=${NOTMUCH_TESTS:=$TESTS} |