summaryrefslogtreecommitdiff
path: root/test/lisp/calendar/time-date-tests.el
diff options
context:
space:
mode:
authorLars Ingebrigtsen <larsi@gnus.org>2022-04-13 15:31:02 +0200
committerLars Ingebrigtsen <larsi@gnus.org>2022-04-13 15:31:34 +0200
commit918669cb3db21eebc9fb409098a4395f131379ee (patch)
tree0b0dbff24165be2804c9911ba05cfca22b862ced /test/lisp/calendar/time-date-tests.el
parente587fc05a70c08a50258b152bb5403afd013007d (diff)
downloademacs-918669cb3db21eebc9fb409098a4395f131379ee.tar.gz
emacs-918669cb3db21eebc9fb409098a4395f131379ee.tar.bz2
emacs-918669cb3db21eebc9fb409098a4395f131379ee.zip
Make list-times not include zero elements
* doc/lispref/os.texi (Time Parsing): Mention %x. * lisp/calendar/time-date.el (format-seconds): Accept a new %x spec that removes trailing zeros (bug#54904). * lisp/emacs-lisp/timer-list.el (list-timers): Don't display trailing zero bits.
Diffstat (limited to 'test/lisp/calendar/time-date-tests.el')
-rw-r--r--test/lisp/calendar/time-date-tests.el9
1 files changed, 7 insertions, 2 deletions
diff --git a/test/lisp/calendar/time-date-tests.el b/test/lisp/calendar/time-date-tests.el
index 5a37c914931..fd4d5ac8a1b 100644
--- a/test/lisp/calendar/time-date-tests.el
+++ b/test/lisp/calendar/time-date-tests.el
@@ -88,14 +88,19 @@
(ert-deftest test-format-seconds ()
(should (equal (format-seconds "%y %d %h %m %s %%" 0) "0 0 0 0 0 %"))
(should (equal (format-seconds "%y %d %h %m %s %%" 9999999) "0 115 17 46 39 %"))
- (should (equal (format-seconds "%y %d %h %m %z %s %%" 1) " 1 %"))
+ (should (equal (format-seconds "%y %d %h %m %z %s %%" 1) "1 %"))
(should (equal (format-seconds "%mm %ss" 66) "1m 6s"))
(should (equal (format-seconds "%mm %5ss" 66) "1m 6s"))
(should (equal (format-seconds "%mm %.5ss" 66.4) "1m 00006s"))
(should (equal (format-seconds "%mm %,1ss" 66.4) "1m 6.4s"))
(should (equal (format-seconds "%mm %5,1ss" 66.4) "1m 6.4s"))
- (should (equal (format-seconds "%mm %.5,1ss" 66.4) "1m 006.4s")))
+ (should (equal (format-seconds "%mm %.5,1ss" 66.4) "1m 006.4s"))
+
+ (should (equal (format-seconds "%hh %z%x%mm %ss" (* 60 2)) "2m"))
+ (should (equal (format-seconds "%hh %z%mm %ss" (* 60 2)) "2m 0s"))
+ (should (equal (format-seconds "%hh %x%mm %ss" (* 60 2)) "0h 2m"))
+ (should (equal (format-seconds "%hh %x%mm %ss" 0) "0h 0m 0s")))
(ert-deftest test-ordinal ()
(should (equal (date-ordinal-to-time 2008 271)