diff options
| author | Ulrich Müller | 2024-08-14 13:57:16 +0200 |
|---|---|---|
| committer | Ulrich Müller | 2024-08-15 08:17:15 +0200 |
| commit | 49e7f1b92daaaa12e42de93d1f7604ae0a1bbeaa (patch) | |
| tree | 6aeaf5d534c9a05eee65029df89a5f590498726e /test/lisp | |
| parent | 2533a60e4256336eb30786a555a8922326c49a8a (diff) | |
| download | emacs-49e7f1b92daaaa12e42de93d1f7604ae0a1bbeaa.tar.gz emacs-49e7f1b92daaaa12e42de93d1f7604ae0a1bbeaa.zip | |
Drop fallback code in date-to-time, update documentation
* lisp/calendar/time-date.el (date-to-time): Drop fallback code.
Document that the default timezone is local time, rather than GMT.
* test/lisp/calendar/time-date-tests.el (test-date-to-time):
Add more test cases.
* doc/lispref/os.texi (Time Parsing): Document that 'date-to-time'
defaults to local time.
* etc/NEWS: Announce the change. (Bug#72570)
Diffstat (limited to 'test/lisp')
| -rw-r--r-- | test/lisp/calendar/time-date-tests.el | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/test/lisp/calendar/time-date-tests.el b/test/lisp/calendar/time-date-tests.el index 6512dd0bd07..f8e434e17b1 100644 --- a/test/lisp/calendar/time-date-tests.el +++ b/test/lisp/calendar/time-date-tests.el | |||
| @@ -42,8 +42,28 @@ | |||
| 42 | '(1 2 3 4)))) | 42 | '(1 2 3 4)))) |
| 43 | 43 | ||
| 44 | (ert-deftest test-date-to-time () | 44 | (ert-deftest test-date-to-time () |
| 45 | (should (equal (format-time-string "%F %T" (date-to-time "2021-12-04")) | 45 | (let ((date-list |
| 46 | "2021-12-04 00:00:00"))) | 46 | '(("2021-12-04" (00 00 00 04 12 2021 nil -1 nil)) |
| 47 | ("2006-05-04T03:02:01Z" (01 02 03 04 05 2006 nil nil 0)) | ||
| 48 | ;; Test cases from timezone-parse-date docstring | ||
| 49 | ("14 Apr 89 03:20" (00 20 03 14 04 1989 nil -1 nil)) | ||
| 50 | ("14 Apr 89 03:20:12 GMT" (12 20 03 14 04 1989 nil nil 0)) | ||
| 51 | ("Fri, 17 Mar 89 4:01" (00 01 04 17 03 1989 nil -1 nil)) | ||
| 52 | ("Fri, 17 Mar 89 4:01:33 GMT" (33 01 04 17 03 1989 nil nil 0)) | ||
| 53 | ("Mon Jan 16 16:12 1989" (00 12 16 16 01 1989 nil -1 nil)) | ||
| 54 | ("Mon Jan 16 16:12:37 GMT 1989" (37 12 16 16 01 1989 nil nil 0)) | ||
| 55 | ("Thu, 11 Apr 16:17:12 91" (12 17 16 11 04 1991 nil -1 nil)) | ||
| 56 | ("Mon, 6 Jul 16:47:20 T 1992" (20 47 16 06 07 1992 nil -1 nil)) | ||
| 57 | ("1996-06-24 21:13:12" (12 13 21 24 06 1996 nil -1 nil)) | ||
| 58 | ("19960624t211312" (12 13 21 24 06 1996 nil -1 nil)) | ||
| 59 | ;; These are parsed incorrectly: | ||
| 60 | ;; "6 May 1992 1641-JST (Wednesday)" | ||
| 61 | ;; "22-AUG-1993 10:59:12.82" | ||
| 62 | ;; "1996-06-24 21:13-ZONE" | ||
| 63 | ))) | ||
| 64 | (dolist (date date-list) | ||
| 65 | (should (equal (date-to-time (car date)) | ||
| 66 | (encode-time (cadr date))))))) | ||
| 47 | 67 | ||
| 48 | (ert-deftest test-days-between () | 68 | (ert-deftest test-days-between () |
| 49 | (should (equal (days-between "2021-10-22" "2020-09-29") 388))) | 69 | (should (equal (days-between "2021-10-22" "2020-09-29") 388))) |