diff options
| author | Lars Ingebrigtsen | 2019-07-11 18:27:06 +0200 |
|---|---|---|
| committer | Lars Ingebrigtsen | 2019-07-11 18:27:12 +0200 |
| commit | 50e7e8101ac6ebd536b6b63dbca99f901398c175 (patch) | |
| tree | e785dcb563c2226cf2c8d3358f20d21450f19265 | |
| parent | 2daeea78335f4dbfd4d61fd3e179b41b48922104 (diff) | |
| download | emacs-50e7e8101ac6ebd536b6b63dbca99f901398c175.tar.gz emacs-50e7e8101ac6ebd536b6b63dbca99f901398c175.zip | |
Add test to time-stamp.el
| -rw-r--r-- | test/lisp/time-stamp-tests.el | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/test/lisp/time-stamp-tests.el b/test/lisp/time-stamp-tests.el new file mode 100644 index 00000000000..3aa659e7a6d --- /dev/null +++ b/test/lisp/time-stamp-tests.el | |||
| @@ -0,0 +1,36 @@ | |||
| 1 | ;;; time-stamp-tests.el --- tests for time-stamp.el -*- lexical-binding: t -*- | ||
| 2 | |||
| 3 | ;; Copyright (C) 2019 Free Software Foundation, Inc. | ||
| 4 | |||
| 5 | ;; This file is part of GNU Emacs. | ||
| 6 | |||
| 7 | ;; GNU Emacs is free software: you can redistribute it and/or modify | ||
| 8 | ;; it under the terms of the GNU General Public License as published by | ||
| 9 | ;; the Free Software Foundation, either version 3 of the License, or | ||
| 10 | ;; (at your option) any later version. | ||
| 11 | |||
| 12 | ;; GNU Emacs is distributed in the hope that it will be useful, | ||
| 13 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 14 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 15 | ;; GNU General Public License for more details. | ||
| 16 | |||
| 17 | ;; You should have received a copy of the GNU General Public License | ||
| 18 | ;; along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. | ||
| 19 | |||
| 20 | ;;; Code: | ||
| 21 | |||
| 22 | (require 'ert) | ||
| 23 | (require 'time-stamp) | ||
| 24 | |||
| 25 | (defun test-stamp (ts-format time) | ||
| 26 | (time-stamp--format (time-stamp-string-preprocess ts-format time) time)) | ||
| 27 | |||
| 28 | (ert-deftest test-time-stamp () | ||
| 29 | (let ((user-login-name "foo") | ||
| 30 | (time-stamp-time-zone t) | ||
| 31 | (time '(23847 24475 657815 318000)) | ||
| 32 | (format "%:y-%02m-%02d %02H:%02M:%02S %u")) | ||
| 33 | (should (equal (test-stamp format time) | ||
| 34 | "2019-07-11 16:11:07 foo")))) | ||
| 35 | |||
| 36 | ;;; time-stamp-tests.el ends here | ||