aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/emacs-address-cleaning.el
blob: 8423245ffefa86f08e5bd3e730f0cedba2c7289f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
(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"
		  "'Foo Bar' <foo@bar.com>"
		  "\"'Foo Bar'\" <foo@bar.com>"
		  "'\"Foo Bar\"' <foo@bar.com>"
		  "'\"'Foo Bar'\"' <foo@bar.com>"
		  "Fred Dibna \\[extraordinaire\\] <fred@dibna.com>"))
	 (expected '("ДБ <db-uknot@stop.me.uk>"
		     "foo (at home) <foo@bar.com>"
		     "foo [at home] <foo@bar.com>"
		     "Foo Bar"
		     "Foo Bar <foo@bar.com>"
		     "Foo Bar <foo@bar.com>"
		     "Foo Bar <foo@bar.com>"
		     "Foo Bar <foo@bar.com>"
		     "Fred Dibna [extraordinaire] <fred@dibna.com>"))
	 (output (mapcar #'notmuch-show-clean-address input)))
    (notmuch-test-expect-equal output expected)))