diff options
| author | Stephen Gildea | 2019-10-09 09:19:10 -0700 |
|---|---|---|
| committer | Stephen Gildea | 2019-10-09 09:19:10 -0700 |
| commit | 600bcde608479fc454e4794add84905d6337d3fa (patch) | |
| tree | fc8b7167dc36390f6ce5872ce215ca12e76b3a67 /test | |
| parent | 3d57c829af571465c261d9f865eeee5ed3cae985 (diff) | |
| download | emacs-600bcde608479fc454e4794add84905d6337d3fa.tar.gz emacs-600bcde608479fc454e4794add84905d6337d3fa.zip | |
time-stamp: revert recent change to "%04y"
* time-stamp.el (time-stamp-string-preprocess): Revert change to "%04y"
format made 2 weeks ago by commit 0e56883878 (the previous commit to
this file). Although undocumented, "%04y" was discovered to be in use
in the wild (2016) and had not issued a warning that it would change.
Add a warning that it will change.
* time-stamp-tests.el (time-stamp-test-year-2digit): add test of "%04y"
Diffstat (limited to 'test')
| -rw-r--r-- | test/lisp/time-stamp-tests.el | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/test/lisp/time-stamp-tests.el b/test/lisp/time-stamp-tests.el index 287b5f486c3..ace5e58e367 100644 --- a/test/lisp/time-stamp-tests.el +++ b/test/lisp/time-stamp-tests.el | |||
| @@ -46,8 +46,7 @@ | |||
| 46 | (put 'with-time-stamp-test-env 'lisp-indent-hook 'defun) | 46 | (put 'with-time-stamp-test-env 'lisp-indent-hook 'defun) |
| 47 | 47 | ||
| 48 | (defmacro time-stamp-should-warn (form) | 48 | (defmacro time-stamp-should-warn (form) |
| 49 | "Similar to `should' but verifies that a format warning is generated. | 49 | "Similar to `should' but verifies that a format warning is generated." |
| 50 | In use before 2019 changes; will be used again after those changes settle." | ||
| 51 | `(let ((warning-count 0)) | 50 | `(let ((warning-count 0)) |
| 52 | (cl-letf (((symbol-function 'time-stamp-conv-warn) | 51 | (cl-letf (((symbol-function 'time-stamp-conv-warn) |
| 53 | (lambda (_old _new) | 52 | (lambda (_old _new) |
| @@ -266,7 +265,10 @@ In use before 2019 changes; will be used again after those changes settle." | |||
| 266 | (should (equal (time-stamp-string "%_y" ref-time) " 6")) | 265 | (should (equal (time-stamp-string "%_y" ref-time) " 6")) |
| 267 | (should (equal (time-stamp-string "%_y" ref-time2) "16")) | 266 | (should (equal (time-stamp-string "%_y" ref-time2) "16")) |
| 268 | (should (equal (time-stamp-string "%y" ref-time) "06")) | 267 | (should (equal (time-stamp-string "%y" ref-time) "06")) |
| 269 | (should (equal (time-stamp-string "%y" ref-time2) "16")))) | 268 | (should (equal (time-stamp-string "%y" ref-time2) "16")) |
| 269 | ;; implemented since 1995, warned since 2019, will change | ||
| 270 | (time-stamp-should-warn (equal (time-stamp-string "%04y" ref-time) "2006")) | ||
| 271 | (time-stamp-should-warn (equal (time-stamp-string "%4y" ref-time) "2006")))) | ||
| 270 | 272 | ||
| 271 | (ert-deftest time-stamp-test-year-4digit () | 273 | (ert-deftest time-stamp-test-year-4digit () |
| 272 | "Test time-stamp format %Y." | 274 | "Test time-stamp format %Y." |