]> git.notmuchmail.org Git - notmuch/blobdiff - test/emacs-address-cleaning.el
test: Add address cleaning tests.
[notmuch] / test / emacs-address-cleaning.el
diff --git a/test/emacs-address-cleaning.el b/test/emacs-address-cleaning.el
new file mode 100644 (file)
index 0000000..19e9e05
--- /dev/null
@@ -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)))