From 51351f56051b549d37af6e1d5fdc7d7737fb3c7d Mon Sep 17 00:00:00 2001 From: yoichi Date: Fri, 3 Nov 2006 01:19:27 +0000 Subject: [PATCH] * test-wl-draft.el: New file. --- tests/ChangeLog | 4 +++ tests/test-wl-draft.el | 90 ++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 94 insertions(+) create mode 100644 tests/test-wl-draft.el diff --git a/tests/ChangeLog b/tests/ChangeLog index 99e150c..e1418c7 100644 --- a/tests/ChangeLog +++ b/tests/ChangeLog @@ -1,3 +1,7 @@ +2006-11-03 Yoichi NAKAYAMA + + * test-wl-draft.el: New file. + 2005-02-27 Yuuichi Teranishi * test-elmo-util.el (test-elmo-same-list-p): New function. diff --git a/tests/test-wl-draft.el b/tests/test-wl-draft.el new file mode 100644 index 0000000..fb48574 --- /dev/null +++ b/tests/test-wl-draft.el @@ -0,0 +1,90 @@ +(require 'lunit) +(require 'wl-draft) + +(luna-define-class test-wl-draft (lunit-test-case)) + +(luna-define-method test-wl-draft-deduce-address-list-1 ((case test-wl-draft)) + (lunit-assert + (equal + '("foo@example.com" "bar@example.com") + (with-temp-buffer + (insert "To: foo@example.com, bar@example.com +") + (wl-draft-deduce-address-list (current-buffer) (point-min) (point-max)))))) + +(luna-define-method test-wl-draft-deduce-address-list-2 ((case test-wl-draft)) + (lunit-assert + (equal + '("foo@example.com" "bar@example.com") + (with-temp-buffer + (insert "To: foo@example.com +Cc: bar@example.com +") + (wl-draft-deduce-address-list (current-buffer) (point-min) (point-max)))))) + +;; RFC 2822 A.1.2. Different types of mailboxes +(luna-define-method test-wl-draft-deduce-address-list-rfc2822-example-1 ((case test-wl-draft)) + (lunit-assert + (equal + '("mary@x.test" "jdoe@example.org" "one@y.test" "boss@nil.test" "sysservices@example.net") + (with-temp-buffer + (insert "From: \"Joe Q. Public\" +To: Mary Smith , jdoe@example.org, Who? +Cc: , \"Giant; \\\"Big\\\" Box\" +Date: Tue, 1 Jul 2003 10:52:37 +0200 +Message-ID: <5678.21-Nov-1997@example.com> +") + (wl-draft-deduce-address-list (current-buffer) (point-min) (point-max)))))) + +;; RFC 2822 A.1.3. Group addresses +(luna-define-method test-wl-draft-deduce-address-list-rfc2822-example-2 ((case test-wl-draft)) + (lunit-assert + (equal + '("c@a.test" "joe@where.test" "jdoe@one.test") + (with-temp-buffer + (insert "From: Pete +To: A Group:Chris Jones ,joe@where.test,John ; +Cc: Undisclosed recipients:; +Date: Thu, 13 Feb 1969 23:32:54 -0330 +Message-ID: +") + (wl-draft-deduce-address-list (current-buffer) (point-min) (point-max)))))) + +;; RFC 2822 A.3. Resent messages +(luna-define-method test-wl-draft-deduce-address-list-rfc2822-example-3 ((case test-wl-draft)) + (lunit-assert + (equal + '("j-brown@other.example") + (with-temp-buffer + (insert "Resent-From: Mary Smith +Resent-To: Jane Brown +Resent-Date: Mon, 24 Nov 1997 14:22:01 -0800 +Resent-Message-ID: <78910@example.net> +From: John Doe +To: Mary Smith +Subject: Saying Hello +Date: Fri, 21 Nov 1997 09:55:06 -0600 +Message-ID: <1234@local.machine.example> +") + (wl-draft-deduce-address-list (current-buffer) (point-min) (point-max)))))) + +;; obs-phrase +(luna-define-method test-wl-draft-deduce-address-list-rfc2822-obs-1 ((case test-wl-draft)) + (lunit-assert + (equal + '("foo@example.com") + (with-temp-buffer + (insert "To: foo.bar +") + (wl-draft-deduce-address-list (current-buffer) (point-min) (point-max)))))) + +;; multiple occurrences of destination address fields +(luna-define-method test-wl-draft-deduce-address-list-rfc2822-obs-2 ((case test-wl-draft)) + (lunit-assert + (equal + '("foo@example.com" "bar@example.com") + (with-temp-buffer + (insert "To: foo@example.com +To: bar@example.com +") + (wl-draft-deduce-address-list (current-buffer) (point-min) (point-max)))))) -- 1.7.10.4