From decce802c2fe22dde7810cb3e317309bdecc63b9 Mon Sep 17 00:00:00 2001 From: kaoru Date: Fri, 1 Jan 2010 08:11:06 +0000 Subject: [PATCH] * test-elmo-util.el (test-elmo-delete-cr-1): New testcase. * test-elmo-date.el (test-elmo-time-parse-date-string-1) (test-elmo-time-parse-date-string-2): New testcase. --- tests/ChangeLog | 6 ++++++ tests/test-elmo-date.el | 49 +++++++++++++++++++++++++++++++++++++++++++++++ tests/test-elmo-util.el | 6 ++++++ 3 files changed, 61 insertions(+) diff --git a/tests/ChangeLog b/tests/ChangeLog index 9f8c6ed..147275c 100644 --- a/tests/ChangeLog +++ b/tests/ChangeLog @@ -1,3 +1,9 @@ +2010-01-01 TAKAHASHI Kaoru + + * test-elmo-util.el (test-elmo-delete-cr-1): New testcase. + * test-elmo-date.el (test-elmo-time-parse-date-string-1) + (test-elmo-time-parse-date-string-2): New testcase. + 2009-08-01 TAKAHASHI Kaoru * test-elmo-imap4.el: New file. diff --git a/tests/test-elmo-date.el b/tests/test-elmo-date.el index 635a774..2f1562c 100644 --- a/tests/test-elmo-date.el +++ b/tests/test-elmo-date.el @@ -16,3 +16,52 @@ (string= "Sun" (elmo-date-get-week 2100 2 28))) (lunit-assert (string= "Mon" (elmo-date-get-week 2100 3 1))))) + +(luna-define-method test-elmo-time-parse-date-string-1 ((case test-elmo-date)) + "" + (lunit-assert + ;; [RFC5322] Appendix A.1.1. + (equal '(13429 44762) + (elmo-time-parse-date-string + "Date: Fri, 21 Nov 1997 09:55:06 -0600"))) + (lunit-assert + ;; [RFC5322] Appendix A.1.2. + (equal '(16129 19413) + (elmo-time-parse-date-string + "Date: Tue, 1 Jul 2003 10:52:37 +0200"))) + ;; (lunit-assert + ;; ;; leapsec + ;; (elmo-time-parse-date-string + ;; "Date: Thu, 1 Jan 2009 08:59:60 +0900")) + + + (lunit-assert + ;; [RFC5322] Appendix A.1.3. + (equal '(-424 63838) + (elmo-time-parse-date-string + "Date: Thu, 13 Feb 1969 23:32:54 -0330"))) +) + +(luna-define-method test-elmo-time-parse-date-string-2 ((case test-elmo-date)) + "Obsolete Date: format" + (lunit-assert + ;; [RFC5322] Appendix A.5. + (equal '(14403 4992) + (elmo-time-parse-date-string + (concat + "Date: Thu,\n" + " 13\n" + " Feb\n" + " 1969\n" + " 23:32\n" + " -0330 (Newfoundland Time)")))) + (lunit-assert + ;; [RFC5322] Appendix A.6.2. + (equal '(13429 23162) + (elmo-time-parse-date-string + "Date: 21 Nov 97 09:55:06 GMT"))) + (lunit-assert + ;; [RFC5322] Appendix A.6.3. + (equal '(13428 52452) + (elmo-time-parse-date-string + "Date : Fri, 21 Nov 1997 09(comment): 55 : 06 -0600")))) diff --git a/tests/test-elmo-util.el b/tests/test-elmo-util.el index 2d5a5e1..01e178f 100644 --- a/tests/test-elmo-util.el +++ b/tests/test-elmo-util.el @@ -324,3 +324,9 @@ (lunit-assert (equal '(1) (elmo-number-set-to-number-list '(1))))) + +(luna-define-method test-elmo-delete-cr-1 ((case test-elmo-util)) + (lunit-assert (string= "" (elmo-delete-cr ""))) + (lunit-assert (string= "\n" (elmo-delete-cr "\r\n"))) + (lunit-assert (string= "\n\n" (elmo-delete-cr "\r\n\n"))) + (lunit-assert (string= "\n\n" (elmo-delete-cr "\r\n\r\n")))) -- 1.7.10.4