]> code.delx.au - gnu-emacs/blob - test/lisp/calendar/parse-time-tests.el
-
[gnu-emacs] / test / lisp / calendar / parse-time-tests.el
1 ;; parse-time-tests.el --- Test suite for parse-time.el
2
3 ;; Copyright (C) 2016 Free Software Foundation, Inc.
4
5 ;; Author: Lars Ingebrigtsen <larsi@gnus.org>
6
7 ;; This file is part of GNU Emacs.
8
9 ;; GNU Emacs is free software: you can redistribute it and/or modify
10 ;; it under the terms of the GNU General Public License as published by
11 ;; the Free Software Foundation, either version 3 of the License, or
12 ;; (at your option) any later version.
13
14 ;; GNU Emacs is distributed in the hope that it will be useful,
15 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
16 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 ;; GNU General Public License for more details.
18
19 ;; You should have received a copy of the GNU General Public License
20 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
21
22 ;;; Commentary:
23
24 ;;; Code:
25
26 (require 'ert)
27 (require 'parse-time)
28
29 (ert-deftest parse-time-tests ()
30 (should (equal (parse-time-string "Mon, 22 Feb 2016 19:35:42 +0100")
31 '(42 35 19 22 2 2016 1 nil 3600)))
32 (should (equal (parse-time-string "22 Feb 2016 19:35:42 +0100")
33 '(42 35 19 22 2 2016 nil nil 3600)))
34 (should (equal (parse-time-string "22 Feb 2016 +0100")
35 '(nil nil nil 22 2 2016 nil nil 3600)))
36 (should (equal (parse-time-string "Mon, 22 Feb 16 19:35:42 +0100")
37 '(42 35 19 22 2 2016 1 nil 3600)))
38 (should (equal (parse-time-string "Mon, 22 February 2016 19:35:42 +0100")
39 '(42 35 19 22 2 2016 1 nil 3600)))
40 (should (equal (parse-time-string "Mon, 22 feb 2016 19:35:42 +0100")
41 '(42 35 19 22 2 2016 1 nil 3600)))
42 (should (equal (parse-time-string "Monday, 22 february 2016 19:35:42 +0100")
43 '(42 35 19 22 2 2016 1 nil 3600)))
44 (should (equal (parse-time-string "Monday, 22 february 2016 19:35:42 PDT")
45 '(42 35 19 22 2 2016 1 t -25200))))
46
47 (provide 'parse-time-tests)
48
49 ;;; parse-time-tests.el ends here