test: Add address cleaning tests.
[notmuch] / test / emacs-address-cleaning.el
1 (defun notmuch-test-address-cleaning-1 ()
2   (notmuch-test-expect-equal (notmuch-show-clean-address "dme@dme.org")
3                         "dme@dme.org"))
4
5 (defun notmuch-test-address-cleaning-2 ()
6   (let* ((input '("foo@bar.com"
7                   "<foo@bar.com>"
8                   "Foo Bar <foo@bar.com>"
9                   "foo@bar.com <foo@bar.com>"
10                   "\"Foo Bar\" <foo@bar.com>"))
11          (expected '("foo@bar.com"
12                      "foo@bar.com"
13                      "Foo Bar <foo@bar.com>"
14                      "foo@bar.com"
15                      "Foo Bar <foo@bar.com>"))
16          (output (mapcar #'notmuch-show-clean-address input)))
17     (notmuch-test-expect-equal output expected)))
18
19 (defun notmuch-test-address-cleaning-3 ()
20   (let* ((input '("ДБ <db-uknot@stop.me.uk>"
21                   "foo (at home) <foo@bar.com>"
22                   "foo [at home] <foo@bar.com>"
23                   "Foo Bar"))
24          (expected '("ДБ <db-uknot@stop.me.uk>"
25                      "foo (at home) <foo@bar.com>"
26                      "foo [at home] <foo@bar.com>"
27                      "Foo Bar"))
28          (output (mapcar #'notmuch-show-clean-address input)))
29     (notmuch-test-expect-equal output expected)))