summaryrefslogtreecommitdiff
path: root/test/lisp/time-stamp-tests.el
Commit message (Collapse)AuthorAgeFilesLines
* time-stamp: Better handling of some edge casesStephen Gildea2025-02-071-5/+31
| | | | | | * lisp/time-stamp.el (time-stamp-count): Require confirmation if large. (time-stamp-once): Correctly handle a start regexp matching 0 chars. * test/lisp/time-stamp-tests.el (time-stamp-custom-start): New test.
* ; time-stamp: documentation, tests, NEWSStephen Gildea2025-02-021-13/+24
| | | | | | | | | * lisp/time-stamp.el (time-stamp-pattern, time-stamp-count): Document how to update different time stamps on multiple lines. * doc/emacs/files.texi (Time stamps): Add an example showing a time stamp at the end of a file. * etc/NEWS: Announce time-stamp format additions. * test/lisp/time-stamp-tests.el: More title-case tests.
* time-stamp: Don't get confused by newline in file nameStephen Gildea2025-01-271-3/+22
| | | | | * lisp/time-stamp.el (time-stamp-filtered-buffer-file-name): New helper * test/lisp/time-stamp-tests.el: (time-stamp-custom-file-name): New test
* time-stamp-tests: Make macro-defined tests findableStephen Gildea2025-01-271-34/+56
| | | | | | * test/lisp/time-stamp-tests.el (define-formatz-tests): Use 'find-function-update-type-alist' to make defined tests findable. (formatz-find-test-def-function): New test-finding function.
* ; time-stamp: Rename some internal symbolsStephen Gildea2025-01-241-33/+33
| | | | | | | * lisp/time-stamp.el: (time-stamp-string-preprocess): Rename 'alt-form' to 'colon-cnt' because it is now an integer. * test/lisp/time-stamp-tests.el: Rename 'formatz-generate-tests' to 'define-formatz-tests'.
* time-stamp: lower- and title-case weekday and month namesStephen Gildea2025-01-061-14/+78
| | | | | | | * lisp/time-stamp.el (time-stamp-string-preprocess): new formats for lowercase weekday name, lowercase month name, and system name * test/lisp/time-stamp.el: new tests (formatz-generate-tests): Better doc strings for generated test fns.
* Update copyright year to 2025Paul Eggert2025-01-011-1/+1
| | | | Run "TZ=UTC0 admin/update-copyright".
* ; * test/lisp/time-stamp-tests.el: make checkdoc happierStephen Gildea2024-12-141-133/+134
|
* time-stamp: fix search end, more compatibility suggestionsStephen Gildea2024-12-141-3/+29
| | | | | | | | | * lisp/time-stamp.el (time-stamp): Use a marker for the search end limit so we don't insert past it. (time-stamp-conv-warn): Include a second suggested conversion that might be what was intended. Include a link to variable 'time-stamp-format'. * test/lisp/time-stamp-tests.el: more tests
* time-stamp: properly abbreviate instead of truncating namesStephen Gildea2024-12-101-112/+161
| | | | | | | | | | * lisp/time-stamp (time-stamp-string-preprocess): Stop truncating month and weekday name strings; it didn't internationalize well. Some historical conversions, previously accepted quietly, now warn. (time-stamp-format): Recommend the simpler formats implemented in 2019. * test/lisp/time-stamp-tests.el: Update tests and comments to match. Revert commit 83e4559664 (2022-07-01), which was working around the former confusion between truncation and abbreviation.
* time-stamp: minor adjustments to %P and modifier charactersStephen Gildea2024-11-081-11/+27
| | | | | | * lisp/time-stamp.el (time-stamp-string-preprocess): %P variations; allow (and ignore) "*", "E", and "O" as modifier characters. (time-stamp-inserts-lines): safe-local-variable only if booleanp
* ; time-stamp: Reformat some long doc strings for clarity.Stephen Gildea2024-11-011-24/+24
| | | | | | | | * lisp/time-stamp.el (time-stamp-format, time-stamp-pattern): Reformat doc strings for clarity. (group time-stamp): is a subgroup of "files", not "data". The "data" group seems to be for editing non-text files. * test/lisp/time-stamp-tests.el: Fix tense of some doc strings.
* Merge from savannah/emacs-29Po Lu2024-01-021-1/+1
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | dc4e6b13296 ; Update copyright years in more files 64b37776318 ; Run set-copyright from admin.el 8e1c56ae467 ; Add 2024 to copyright years # Conflicts: # doc/misc/modus-themes.org # doc/misc/texinfo.tex # etc/NEWS # etc/refcards/ru-refcard.tex # etc/themes/modus-operandi-theme.el # etc/themes/modus-themes.el # etc/themes/modus-vivendi-theme.el # lib/alloca.in.h # lib/binary-io.h # lib/c-ctype.h # lib/c-strcasecmp.c # lib/c-strncasecmp.c # lib/careadlinkat.c # lib/cloexec.c # lib/close-stream.c # lib/diffseq.h # lib/dup2.c # lib/filemode.h # lib/fpending.c # lib/fpending.h # lib/fsusage.c # lib/getgroups.c # lib/getloadavg.c # lib/gettext.h # lib/gettime.c # lib/gettimeofday.c # lib/group-member.c # lib/malloc.c # lib/md5-stream.c # lib/md5.c # lib/md5.h # lib/memmem.c # lib/memrchr.c # lib/nanosleep.c # lib/save-cwd.h # lib/sha1.c # lib/sig2str.c # lib/stdlib.in.h # lib/strtoimax.c # lib/strtol.c # lib/strtoll.c # lib/time_r.c # lib/xalloc-oversized.h # lisp/auth-source-pass.el # lisp/emacs-lisp/lisp-mnt.el # lisp/emacs-lisp/timer.el # lisp/info-look.el # lisp/jit-lock.el # lisp/loadhist.el # lisp/mail/rmail.el # lisp/net/ntlm.el # lisp/net/webjump.el # lisp/progmodes/asm-mode.el # lisp/progmodes/project.el # lisp/progmodes/sh-script.el # lisp/textmodes/flyspell.el # lisp/textmodes/reftex-toc.el # lisp/textmodes/reftex.el # lisp/textmodes/tex-mode.el # lisp/url/url-gw.el # m4/alloca.m4 # m4/clock_time.m4 # m4/d-type.m4 # m4/dirent_h.m4 # m4/dup2.m4 # m4/euidaccess.m4 # m4/fchmodat.m4 # m4/filemode.m4 # m4/fsusage.m4 # m4/getgroups.m4 # m4/getloadavg.m4 # m4/getrandom.m4 # m4/gettime.m4 # m4/gettimeofday.m4 # m4/gnulib-common.m4 # m4/group-member.m4 # m4/inttypes.m4 # m4/malloc.m4 # m4/manywarnings.m4 # m4/mempcpy.m4 # m4/memrchr.m4 # m4/mkostemp.m4 # m4/mktime.m4 # m4/nproc.m4 # m4/nstrftime.m4 # m4/pathmax.m4 # m4/pipe2.m4 # m4/pselect.m4 # m4/pthread_sigmask.m4 # m4/readlink.m4 # m4/realloc.m4 # m4/sig2str.m4 # m4/ssize_t.m4 # m4/stat-time.m4 # m4/stddef_h.m4 # m4/stdint.m4 # m4/stdio_h.m4 # m4/stdlib_h.m4 # m4/stpcpy.m4 # m4/strnlen.m4 # m4/strtoimax.m4 # m4/strtoll.m4 # m4/time_h.m4 # m4/timegm.m4 # m4/timer_time.m4 # m4/timespec.m4 # m4/unistd_h.m4 # m4/warnings.m4 # nt/configure.bat # nt/preprep.c # test/lisp/register-tests.el
| * ; Add 2024 to copyright yearsPo Lu2024-01-021-1/+1
| |
* | Further improve test coverage of time-stamp-pattern parsingStephen Gildea2023-11-041-11/+21
|/ | | | | | | * test/lisp/time-stamp-tests.el (time-stamp-custom-pattern): Use test strings that are easier to mis-parse, for a more exacting test. * (fz-make+zone, fz-make-zone): Declare pure.
* ; Add 2023 to copyright years.Eli Zaretskii2023-01-011-1/+1
|
* ; improve test coverage of time-stamp-pattern parsingStephen Gildea2022-10-141-4/+4
| | | | | * test/lisp/time-stamp-tests.el (time-stamp-test-pattern-multiply, time-stamp-test-pattern-sequential): broaden range of test data
* Prefer pos-bol and pos-eol in testsStefan Kangas2022-08-211-4/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * test/lisp/calendar/todo-mode-tests.el (todo-test-toggle-item-header02, todo-test-edit-item-date-month) (todo-test-multiline-item-indentation-1) (todo-test-multiline-item-indentation-2) (todo-test-multiline-item-indentation-3): * test/lisp/cedet/semantic-utest-ia.el (semantic-ia-utest-buffer) (semantic-sr-utest-buffer-refs): * test/lisp/cedet/semantic-utest.el (semantic-utest-kill-indicator) (semantic-utest-unkill-indicator): * test/lisp/dired-tests.el (dired-test-bug27968): * test/lisp/emacs-lisp/backtrace-tests.el (backtrace-tests--verify-single-and-multi-line): * test/lisp/emacs-lisp/find-func-tests.el (find-func-tests--find-library-verbose): * test/lisp/erc/erc-tests.el (erc-ring-previous-command) (erc-log-irc-protocol): * test/lisp/gnus/message-tests.el (message-mode-propertize): * test/lisp/info-xref-tests.el (info-xref-test-emacs-manuals): * test/lisp/mail/footnote-tests.el (footnote-tests-same-place): * test/lisp/progmodes/elisp-mode-tests.el (elisp-shorthand-completion-at-point): * test/lisp/progmodes/f90-tests.el (f90-test-bug38415): * test/lisp/progmodes/python-tests.el (python-indent-electric-comma-inside-multiline-string) (python-indent-electric-comma-after-multiline-string) (python-indent-electric-colon-1, python-indent-electric-colon-2) (python-indent-electric-colon-3, python-indent-electric-colon-4) (python-mark-defun-2, python-mark-defun-3, python-mark-defun-4) (python-mark-defun-5, python-nav-end-of-defun-2) (python-nav-end-of-statement-1, python-nav-end-of-block-1) (python-indent-dedent-line-backspace-2) (python-indent-dedent-line-backspace-3) (python-eldoc--get-symbol-at-point-1) (python-info-beginning-of-statement-p-1) (python-info-beginning-of-statement-p-2): * test/lisp/replace-tests.el (replace-occur-revert-bug32543) (replace-occur-revert-bug32987): * test/lisp/simple-tests.el (simple-delete-indentation-boundaries) (simple-delete-indentation-region) (line-number-at-pos-in-narrow-buffer) (line-number-at-pos-keeps-restriction): * test/lisp/textmodes/css-mode-tests.el (css-mode-test-selectors) (scss-mode-test-selectors): * test/lisp/textmodes/fill-tests.el (fill-test-unbreakable-paragraph) (fill-test-breakable-paragraph): * test/lisp/time-stamp-tests.el (time-stamp-custom-pattern): * test/src/lread-tests.el (lread-tests--last-message): * test/src/process-tests.el (set-process-filter-t): * test/src/undo-tests.el (undo-test-skip-invalidated-markers): Prefer pos-bol and pos-eol.
* Make time-stamp-tests.el work in a Norwegian language enviromentLars Ingebrigtsen2022-07-011-6/+11
| | | | | | | | | | | | | | The short version of names for days/month is not necessary the same as limiting the string with a #n operator. For instance: (format-time-string "%^A" time) => "FREDAG" (format-time-string "%^a" time) => "FR." (time-stamp-string "%#3a" time) => "FRE"
* Merge from origin/emacs-28Eli Zaretskii2022-01-011-1/+1
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 836be7a112 ; * etc/refcards/ru-refcard.tex: Update Copyright year. 86cbc6ee4a * lisp/net/tramp-sh.el: Adapt copyright year ebe8772f65 ; Minor fixes related to copyright years 23c1ee6989 ; * test/manual/etags/ETAGS.good_N: Adjust to copyright ye... 8d3fc7ec89 * src/xfaces.c (face_for_font): Make 'hash' be uintptr_t. 19dcb237b5 ; Add 2022 to copyright years. # Conflicts: # etc/NEWS # etc/refcards/ru-refcard.tex # lib/cdefs.h # lisp/erc/erc-dcc.el # lisp/erc/erc-imenu.el # lisp/erc/erc-replace.el # lisp/image-dired.el # lisp/progmodes/xref.el # m4/alloca.m4 # m4/byteswap.m4 # m4/errno_h.m4 # m4/getopt.m4 # m4/gnulib-common.m4 # m4/inttypes.m4 # m4/stddef_h.m4 # m4/stdint.m4 # m4/sys_socket_h.m4
| * ; Add 2022 to copyright years.Eli Zaretskii2022-01-011-1/+1
| |
* | time-stamp-tests.el: Test more formatsStephen Gildea2021-11-261-3/+7
|/ | | | | | * test/lisp/time-stamp-tests.el (time-stamp-format-ignored-modifiers): Additional testing with illegal formats, including "%". (time-stamp-format-multiple-conversions): Add a test with "%%%".
* time-stamp: %F is "file name" not "pathname" + other docStephen Gildea2021-11-091-5/+6
| | | | | | * lisp/time-stamp.el (time-stamp-format): doc 'file' instead of 'path'. * test/lisp/time-stamp-tests.el (formatz, format-time-offset): Clarify the difference and similarity between these two test helpers.
* time-stamp-tests: improvements to test macrosStephen Gildea2021-10-221-5/+8
| | | | | | test/lisp/time-stamp-tests.el: Update macro declarations. (formatz-generate-tests): Don't nconc onto a constant list. Tests now run 12% faster in batch mode.
* ; Minor stylistic checkdoc fixes in test/**/*.elStefan Kangas2021-09-261-3/+3
|
* ; Clarify and simplify time-stamp commentsStephen Gildea2021-09-261-3/+3
| | | | | | | * lisp/time-stamp.el (time-stamp-end, time-stamp-string-preprocess, time-stamp-formatz-from-parsed-options): Simplify doc. * test/lisp/time-stamp-tests.el (time-stamp-custom-pattern): Refactor to set limit-number only once.
* Use string-replace instead of replace-regexp-in-stringMattias Engdegård2021-08-081-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | `string-replace` is easier to understand, less error-prone, much faster, and results in shorter Lisp and byte code. Use it where applicable and obviously safe (erring on the conservative side). * admin/authors.el (authors-scan-change-log): * lisp/autoinsert.el (auto-insert-alist): * lisp/calc/calc-prog.el (calc-edit-macro-combine-alg-ent) (calc-edit-macro-combine-ext-command) (calc-edit-macro-combine-var-name): * lisp/calc/calc-units.el (math-make-unit-string): * lisp/calendar/cal-html.el (cal-html-comment): * lisp/calendar/cal-tex.el (cal-tex-comment): * lisp/calendar/icalendar.el (icalendar--convert-string-for-export) (icalendar--convert-string-for-import): * lisp/calendar/iso8601.el (iso8601--concat-regexps) (iso8601--full-time-match, iso8601--combined-match): * lisp/calendar/time-date.el (format-seconds): * lisp/calendar/todo-mode.el (todo-filter-items-filename): * lisp/cedet/cedet-files.el (cedet-directory-name-to-file-name) (cedet-file-name-to-directory-name): * lisp/comint.el (comint-watch-for-password-prompt): * lisp/dired-aux.el (dired-do-chmod): * lisp/dired-x.el (dired-man): * lisp/dired.el (dired-insert-directory, dired-goto-file-1): * lisp/emacs-lisp/comp.el (comp-c-func-name): * lisp/emacs-lisp/re-builder.el (reb-copy): * lisp/erc/erc-dcc.el (erc-dcc-unquote-filename): * lisp/erc/erc.el (erc-quit-reason-zippy, erc-part-reason-zippy) (erc-update-mode-line-buffer, erc-message-english-PART): * lisp/files.el (make-backup-file-name-1, files--transform-file-name) (read-file-modes): * lisp/fringe.el (fringe-mode): * lisp/gnus/gnus-art.el (gnus-button-handle-info-url): * lisp/gnus/gnus-group.el (gnus-group-completing-read): * lisp/gnus/gnus-icalendar.el (gnus-icalendar-event-from-ical): * lisp/gnus/gnus-mlspl.el (gnus-group-split-fancy): * lisp/gnus/gnus-search.el (gnus-search-query-parse-date) (gnus-search-transform-expression, gnus-search-run-search): * lisp/gnus/gnus-start.el (gnus-dribble-enter): * lisp/gnus/gnus-sum.el (gnus-summary-refer-article): * lisp/gnus/gnus-util.el (gnus-mode-string-quote): * lisp/gnus/message.el (message-put-addresses-in-ecomplete) (message-parse-mailto-url, message-mailto-1): * lisp/gnus/mml-sec.el (mml-secure-epg-sign): * lisp/gnus/mml-smime.el (mml-smime-epg-verify): * lisp/gnus/mml2015.el (mml2015-epg-verify): * lisp/gnus/nnmaildir.el (nnmaildir--system-name) (nnmaildir-request-list, nnmaildir-retrieve-groups) (nnmaildir-request-group, nnmaildir-retrieve-headers): * lisp/gnus/nnrss.el (nnrss-node-text): * lisp/gnus/spam-report.el (spam-report-gmane-internal) (spam-report-user-mail-address): * lisp/ibuffer.el (name): * lisp/image-dired.el (image-dired-pngnq-thumb) (image-dired-pngcrush-thumb, image-dired-optipng-thumb) (image-dired-create-thumb-1): * lisp/info.el (Info-set-mode-line): * lisp/international/mule-cmds.el (describe-language-environment): * lisp/mail/rfc2231.el (rfc2231-parse-string): * lisp/mail/rfc2368.el (rfc2368-parse-mailto-url): * lisp/mail/rmail.el (rmail-insert-inbox-text) (rmail-simplified-subject-regexp): * lisp/mail/rmailout.el (rmail-output-body-to-file): * lisp/mail/undigest.el (rmail-digest-rfc1153): * lisp/man.el (Man-default-man-entry): * lisp/mouse.el (minor-mode-menu-from-indicator): * lisp/mpc.el (mpc--debug): * lisp/net/browse-url.el (browse-url-mail): * lisp/net/eww.el (eww-update-header-line-format): * lisp/net/newst-backend.el (newsticker-save-item): * lisp/net/rcirc.el (rcirc-sentinel): * lisp/net/soap-client.el (soap-decode-date-time): * lisp/nxml/rng-cmpct.el (rng-c-literal-2-re): * lisp/nxml/xmltok.el (let*): * lisp/obsolete/nnir.el (nnir-run-swish-e, nnir-run-hyrex) (nnir-run-find-grep): * lisp/play/dunnet.el (dun-doassign): * lisp/play/handwrite.el (handwrite): * lisp/proced.el (proced-format-args): * lisp/profiler.el (profiler-report-header-line-format): * lisp/progmodes/gdb-mi.el (gdb-mi-quote): * lisp/progmodes/make-mode.el (makefile-bsdmake-rule-action-regex) (makefile-make-font-lock-keywords): * lisp/progmodes/prolog.el (prolog-guess-fill-prefix): * lisp/progmodes/ruby-mode.el (ruby-toggle-string-quotes): * lisp/progmodes/sql.el (sql-remove-tabs-filter, sql-str-literal): * lisp/progmodes/which-func.el (which-func-current): * lisp/replace.el (query-replace-read-from) (occur-engine, replace-quote): * lisp/select.el (xselect--encode-string): * lisp/ses.el (ses-export-tab): * lisp/subr.el (shell-quote-argument): * lisp/term/pc-win.el (msdos-show-help): * lisp/term/w32-win.el (w32--set-selection): * lisp/term/xterm.el (gui-backend-set-selection): * lisp/textmodes/picture.el (picture-tab-search): * lisp/thumbs.el (thumbs-call-setroot-command): * lisp/tooltip.el (tooltip-show-help-non-mode): * lisp/transient.el (transient-format-key): * lisp/url/url-mailto.el (url-mailto): * lisp/vc/log-edit.el (log-edit-changelog-ours-p): * lisp/vc/vc-bzr.el (vc-bzr-status): * lisp/vc/vc-hg.el (vc-hg--glob-to-pcre): * lisp/vc/vc-svn.el (vc-svn-after-dir-status): * lisp/xdg.el (xdg-desktop-strings): * test/lisp/electric-tests.el (defun): * test/lisp/term-tests.el (term-simple-lines): * test/lisp/time-stamp-tests.el (formatz-mod-del-colons): * test/lisp/wdired-tests.el (wdired-test-bug32173-01) (wdired-test-unfinished-edit-01): * test/src/json-tests.el (json-parse-with-custom-null-and-false-objects): Use `string-replace` instead of `replace-regexp-in-string`.
* Add doc string to time-stamp-tests that didn't have oneStephen Gildea2021-07-181-2/+9
| | | | | * test/lisp/time-stamp-tests.el (formatz-generate-tests, formatz-%z-spotcheck): Add doc strings to tests.
* time-stamp: add principled, expressive %zStephen Gildea2021-06-211-4/+410
| | | | | | | | * lisp/time-stamp.el (time-stamp-formatz-from-parsed-options): New function for time zone offset formatting ("%z" variants). * test/lisp/time-stamp-tests.el (formatz*): New unit tests to cover the new implementation of %5z.
* time-stamp: fix minor bug when parsing option combosStephen Gildea2021-05-301-1/+2
| | | | | | | | * lisp/time-stamp.el (time-stamp-string-preprocess): Handle digit options correctly to avoid overcounting colon options. * test/lisp/time-stamp-tests.el (time-stamp-format-time-zone-offset): Add a new test case that would have caught the option-parsing error.
* time-stamp: improve unit-test coverageStephen Gildea2021-05-291-1/+34
| | | | | | * test/lisp/time-stamp-tests.el (time-stamp-format-year-4digit, time-stamp-format-ignored-modifiers): Improve coverage with more cases. (time-stamp-format-multiple-conversions): New test.
* time-stamp-tests now pass in more localesStephen Gildea2021-01-181-52/+75
| | | | | | | | Update time-stamp-tests to use format-time-string to generate the date words (month, day of week, AM/PM) instead of hard-coding English. Now the tests pass in locales other than "C" and US English. Expand the test coverage of modifier characters.
* Update copyright year to 2021Paul Eggert2021-01-011-1/+1
| | | | Run "TZ=UTC0 admin/update-copyright".
* Merge from origin/emacs-27Paul Eggert2020-01-011-1/+1
|\ | | | | | | | | | | | | | | | | | | | | 186152ba40 Pacify gcc -Wunused-function on Ubuntu 18.04.3 4cd143aded Fix copyright years by hand 365e01cc9f Update copyright year to 2020 cd2c156163 ; * etc/NEWS: Make the description of XDG fallback more ac... # Conflicts: # etc/NEWS # etc/refcards/ru-refcard.tex
| * Update copyright year to 2020Paul Eggert2020-01-011-1/+1
| | | | | | | | Run "TZ=UTC0 admin/update-copyright $(git ls-files)".
* | Further expand coverage of unit tests for time-stampStephen Gildea2019-12-231-24/+86
|/ | | | | | | | | * test/lisp/time-stamp-tests.el (time-stamp-custom-format-tabs-expand, time-stamp-custom-end, time-stamp-helper-string-defaults): New tests. (time-stamp-custom-count): Test 0 case. (time-stamp-format-non-date-conversions): Test different system values. Development of these new tests was guided by the "testcover" library.
* Expand coverage of unit tests for time-stampStephen Gildea2019-11-191-23/+196
| | | | | | | | * test/lisp/time-stamp-tests.el: Remove redundant word "test" from the names of all the tests. (time-stamp-custom-time-zone, time-stamp-custom-pattern, time-stamp-custom-inserts-lines, time-stamp-custom-count, time-stamp-helper-safe-locals): New tests
* time-stamp: update support for time zone numeric offsetStephen Gildea2019-11-131-10/+15
| | | | | | | | | * time-stamp.el (time-stamp-string-preprocess): Change new format for numeric time zone from %:z to %5z to match format-time-string better. (time-stamp-format): Document support for numeric time zone. See discussion in bug#32931. * NEWS: Mention time-stamp-format %5z.
* time-stamp: add support for time zone numeric offsetStephen Gildea2019-11-061-4/+19
| | | | | | | | | | | | | * time-stamp.el: Implement %:z as expanding to the numeric time zone offset, to address the feature request of bug#32931. Do not document it yet, to discourage compatibility problems in mixed Emacs 26 and Emacs 27 environments. Documentation will be added in a subsequent release at least two years later. (We cannot yet use %z for numeric time zone because in Emacs 26 it was documented to do something else.) * time-stamp-tests.el (time-stamp-test-format-time-zone): expand this test and break it into two tests, time-stamp-test-format-time-zone-name and time-stamp-test-format-time-zone-offset.
* time-stamp-time-zone: update customizationStephen Gildea2019-10-271-0/+19
| | | | | | | | | | | * time-stamp.el (time-stamp-time-zone): Support customization with an integer offset (a new possible value of the ZONE argument to format-time-string in Emacs 27). Update the safe-local-variable predicate from string-or-null-p (describing time-stamp-time-zone's domain before 2015) to new predicate time-stamp-zone-type-p (describing the current domain). * time-stamp-tests.el (time-stamp-test-helper-zone-type-p): New test.
* time-stamp-tests: add name prefix to tests of formattingStephen Gildea2019-10-261-17/+17
| | | | | | * time-stamp-tests.el: rename all the time-stamp-string formatting tests to have the word "format" in their name, to make room in the namespace for other, future tests.
* time-stamp-tests: consistently name the time varsStephen Gildea2019-10-251-95/+97
| | | | | * time-stamp-tests.el (with-time-stamp-test-env): rename local variable 'ref-time' to 'ref-time1', for parallelism with ref-time2 and ref-time3.
* Minor tweaks to time-stamp documentation stringsStephen Gildea2019-10-131-1/+1
| | | | | | | | | | * time-stamp.el (time-stamp): Reformat the explanation of the variables that affect time-stamp, for easier reading. In particular, wrap the documentation to 75 characters, so that it displays neatly as a before-save-hook customization option. * time-stamp-tests.el (with-time-stamp-test-env): Use imperative voice, per checkdoc.
* Port time-stamp-test-time-zone to macOSPaul Eggert2019-10-101-6/+8
| | | | | | | Problem reported by Stefan Kangas in: https://lists.gnu.org/r/emacs-devel/2019-10/msg00360.html * test/lisp/time-stamp-tests.el (time-stamp-test-time-zone): Don’t assume (format-time-string "%Z" 0 t) returns "GMT".
* time-stamp: revert recent change to "%04y"Stephen Gildea2019-10-091-3/+5
| | | | | | | | | | * 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"
* Expand testing of time-stamp format "%y"Stephen Gildea2019-10-091-12/+26
| | | | | | | * time-stamp-tests.el (time-stamp-test-year): break into two tests, time-stamp-test-year-2digit and time-stamp-test-year-4digit. Expand time-stamp-test-year-2digit to look more like tests for other 2-digit conversions.
* Move undocumented time-stamp formats closer to format-time-stringStephen Gildea2019-09-301-54/+73
| | | | | | | | | * time-stamp.el (time-stamp-string-preprocess): Update some undocumented formatting characters of time-stamp format for closer (still incomplete) alignment with format-time-string. They have displayed a warning since Emacs 20 (released in 1997), so it is unlikely anyone is using them. * time-stamp-tests.el: Update tests to match new expectations.
* time-stamp doc: recommend formats closer to format-time-stringStephen Gildea2019-09-301-19/+23
| | | | | | | | | | * time-stamp.el (time-stamp-format, time-stamp-pattern): Update recommended (documented) formats. No code changes, just documentation. All recommended formats are compatible at least as far back as Emacs 22.1 (released in 2007) and are now closer to compatibility with format-time-string. * time-stamp-tests.el: Update test comments to match.
* Reorganize time-stamp testsStephen Gildea2019-09-281-103/+112
| | | | | | | | * time-stamp-tests.el: Group tests by when the format was or will be documented. Add tests for a few more undocumented, volatile formats. Change AM hours test time to be a different hour from PM test time. (Making these changes to the tests now will minimize test changes needed later with anticipated code changes.)
* Expand time-stamp unit tests to cover all formatting optionsStephen Gildea2019-09-221-9/+284
| | | | | | | | | | | | | | | | | * time-stamp-tests.el: Expand unit tests to cover all formatting options. These tests validate time-stamp-pattern formatting that has existed since at least Emacs 22 (released in 2007). The tests cover both documented behavior and behavior implemented to support future migrations. * time-stamp.el (time-stamp-string): Add a second argument (TIME) to open a testing seam. Have the unit tests call this public function. * time-stamp.el (time-stamp-string, time-stamp-string-preprocess): Remove the second pass through time-string--format. (Previously both functions called it.) It was used only to handle "%", but this is now handled by having time-stamp-string-preprocess not double it. Not doubling the "%" in time-stamp-string-preprocess fixes the padding of "%2%", which was discovered by the new unit tests to be wrong.