mirror of
git://git.sv.gnu.org/emacs.git
synced 2025-12-06 06:20:55 -08:00
time-stamp: Add test of multi-line start regexp
* test/lisp/time-stamp-tests.el: (time-stamp-custom-start-multiline): New test, inspired by Amin Bandali.
This commit is contained in:
parent
c2e2a86d1b
commit
77a57041d0
1 changed files with 13 additions and 1 deletions
|
|
@ -164,7 +164,7 @@
|
||||||
(iter-yield-from (time-stamp-test-pattern-sequential))
|
(iter-yield-from (time-stamp-test-pattern-sequential))
|
||||||
(iter-yield-from (time-stamp-test-pattern-multiply)))
|
(iter-yield-from (time-stamp-test-pattern-multiply)))
|
||||||
|
|
||||||
(ert-deftest time-stamp-custom-start ()
|
(ert-deftest time-stamp-custom-start-0 ()
|
||||||
"Test that `time-stamp' isn't stuck by a start matching 0 characters."
|
"Test that `time-stamp' isn't stuck by a start matching 0 characters."
|
||||||
(with-time-stamp-test-env
|
(with-time-stamp-test-env
|
||||||
(with-time-stamp-test-time ref-time1
|
(with-time-stamp-test-time ref-time1
|
||||||
|
|
@ -189,6 +189,18 @@
|
||||||
(time-stamp)
|
(time-stamp)
|
||||||
(should (equal (buffer-string) "::05::05")))))))
|
(should (equal (buffer-string) "::05::05")))))))
|
||||||
|
|
||||||
|
(ert-deftest time-stamp-custom-start-multiline ()
|
||||||
|
"Test `time-stamp-start' matching across multiple lines."
|
||||||
|
(with-time-stamp-test-env
|
||||||
|
(with-time-stamp-test-time ref-time1
|
||||||
|
(let ((time-stamp-pattern "l.1\n%Y-%m-%d<-TS")) ;start includes newline
|
||||||
|
(with-temp-buffer
|
||||||
|
(insert "l.1\n<-TS\n")
|
||||||
|
;; we should look for the end on the line where the start ends,
|
||||||
|
;; not the line where the start starts
|
||||||
|
(time-stamp)
|
||||||
|
(should (equal (buffer-string) "l.1\n2006-01-02<-TS\n")))))))
|
||||||
|
|
||||||
(ert-deftest time-stamp-custom-pattern ()
|
(ert-deftest time-stamp-custom-pattern ()
|
||||||
"Test that `time-stamp-pattern' is parsed correctly."
|
"Test that `time-stamp-pattern' is parsed correctly."
|
||||||
(iter-do (pattern-parts (time-stamp-test-pattern-all))
|
(iter-do (pattern-parts (time-stamp-test-pattern-all))
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue