This commit was manufactured by cvs2svn to create branch 'elmo-
[elisp/wanderlust.git] / tests / test-elmo-date.el
1 (require 'lunit)
2 (require 'elmo-date)
3
4 (luna-define-class test-elmo-date (lunit-test-case))
5
6 (luna-define-method test-elmo-date-get-week ((case test-elmo-date))
7   "Check around singularity date. leap year and 2038-01-19."
8   (let ((elmo-lang "en"))
9     (lunit-assert
10      (string= "Fri" (elmo-date-get-week 1582 10 15)))
11     (lunit-assert
12      (string= "Tue" (elmo-date-get-week 2000 2 29)))
13     (lunit-assert
14      (string= "Tue" (elmo-date-get-week 2038 1 19)))
15     (lunit-assert
16      (string= "Wed" (elmo-date-get-week 2038 1 20)))
17     (lunit-assert
18      (string= "Sun" (elmo-date-get-week 2100 2 28)))
19     (lunit-assert
20      (string= "Mon" (elmo-date-get-week 2100 3 1)))))
21
22 (luna-define-method test-elmo-time-parse-date-string-1 ((case test-elmo-date))
23   ""
24   (lunit-assert
25    ;; [RFC5322] Appendix A.1.1.
26    (equal '(13429 44762)
27           (elmo-time-parse-date-string
28            "Date: Fri, 21 Nov 1997 09:55:06 -0600")))
29   (lunit-assert
30    ;; [RFC5322] Appendix A.1.2.
31    (equal '(16129 19413)
32           (elmo-time-parse-date-string
33            "Date: Tue, 1 Jul 2003 10:52:37 +0200")))
34   ;; (lunit-assert
35   ;;  ;; leapsec
36   ;;  (elmo-time-parse-date-string
37   ;;   "Date: Thu, 1 Jan 2009 08:59:60 +0900"))
38
39
40   (lunit-assert
41    ;; [RFC5322] Appendix A.1.3.
42    (equal '(-424 63838)
43           (elmo-time-parse-date-string
44            "Date: Thu, 13 Feb 1969 23:32:54 -0330")))
45 )
46
47 (luna-define-method test-elmo-time-parse-date-string-2 ((case test-elmo-date))
48   "Obsolete Date: format"
49   (lunit-assert
50    ;; [RFC5322] Appendix A.5.
51    (equal '(14403 4992)
52           (elmo-time-parse-date-string
53            (concat
54             "Date: Thu,\n"
55             "      13\n"
56             "        Feb\n"
57             "          1969\n"
58             "        23:32\n"
59             "                 -0330 (Newfoundland Time)"))))
60   (lunit-assert
61    ;; [RFC5322] Appendix A.6.2.
62    (equal '(13429 23162)
63           (elmo-time-parse-date-string
64            "Date: 21 Nov 97 09:55:06 GMT")))
65   (lunit-assert
66    ;; [RFC5322] Appendix A.6.3.
67    (equal '(13428 52452)
68           (elmo-time-parse-date-string
69            "Date  : Fri, 21 Nov 1997 09(comment):   55  :  06 -0600"))))