mirror of
https://git.notmuchmail.org/git/notmuch
synced 2024-11-28 13:44:12 +01:00
test: Add address cleaning tests.
This commit is contained in:
parent
f92d7dee8f
commit
3699fedb3a
3 changed files with 49 additions and 0 deletions
29
test/emacs-address-cleaning.el
Normal file
29
test/emacs-address-cleaning.el
Normal file
|
@ -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)))
|
19
test/emacs-address-cleaning.sh
Executable file
19
test/emacs-address-cleaning.sh
Executable file
|
@ -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
|
|
@ -53,6 +53,7 @@ TESTS="
|
||||||
hooks
|
hooks
|
||||||
argument-parsing
|
argument-parsing
|
||||||
emacs-test-functions.sh
|
emacs-test-functions.sh
|
||||||
|
emacs-address-cleaning.sh
|
||||||
"
|
"
|
||||||
TESTS=${NOTMUCH_TESTS:=$TESTS}
|
TESTS=${NOTMUCH_TESTS:=$TESTS}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue