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