* test-elmo-util.el (test-elmo-delete-cr-1): New testcase.
authorkaoru <kaoru>
Fri, 1 Jan 2010 08:11:06 +0000 (08:11 +0000)
committerkaoru <kaoru>
Fri, 1 Jan 2010 08:11:06 +0000 (08:11 +0000)
* test-elmo-date.el (test-elmo-time-parse-date-string-1)
(test-elmo-time-parse-date-string-2): New testcase.

tests/ChangeLog
tests/test-elmo-date.el
tests/test-elmo-util.el

index 9f8c6ed..147275c 100644 (file)
@@ -1,3 +1,9 @@
+2010-01-01  TAKAHASHI Kaoru  <kaoru@kaisei.org>
+
+       * 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  <kaoru@kaisei.org>
 
        * test-elmo-imap4.el: New file.
index 635a774..2f1562c 100644 (file)
      (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"))))
index 2d5a5e1..01e178f 100644 (file)
   (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"))))