diff options
| author | F. Jason Park | 2024-06-05 00:22:28 -0700 |
|---|---|---|
| committer | F. Jason Park | 2024-06-08 12:21:14 -0700 |
| commit | f6bfa1844b53d6ccd24fd02092ae482d481fc5a5 (patch) | |
| tree | 030032b2370b6fa1197db8f24f50cba69ec32f8b /test | |
| parent | 772fb960a948b6951f24442b372ce6833887669b (diff) | |
| download | emacs-f6bfa1844b53d6ccd24fd02092ae482d481fc5a5.tar.gz emacs-f6bfa1844b53d6ccd24fd02092ae482d481fc5a5.zip | |
Restore deferred date-stamp insertions in ERC
* lisp/erc/erc-stamp.el (erc-stamp--recover-on-reconnect): Treat
`erc-stamp--deferred-date-stamp' as a permanent-local variable.
(erc-stamp--date): Document expected possible values for `fn' slot.
(erc-stamp--defer-date-insertion-on-post-modify): Use the function
`ignore' to mean a new `erc-timer-hook' member has been requested.
Use nil to mean one has already run. Deferred date stamps are new in
ERC 5.6 and Emacs 30.
(erc-stamp--date-mode): Improve doc string.
* test/lisp/erc/erc-scenarios-stamp.el
(erc-scenarios-stamp--date-mode/reconnect): New test.
Diffstat (limited to 'test')
| -rw-r--r-- | test/lisp/erc/erc-scenarios-stamp.el | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/test/lisp/erc/erc-scenarios-stamp.el b/test/lisp/erc/erc-scenarios-stamp.el index 6f2fbc1b7e9..2e836e163bc 100644 --- a/test/lisp/erc/erc-scenarios-stamp.el +++ b/test/lisp/erc/erc-scenarios-stamp.el | |||
| @@ -180,4 +180,50 @@ | |||
| 180 | 180 | ||
| 181 | (funcall expect 5 "This server is in debug mode"))))) | 181 | (funcall expect 5 "This server is in debug mode"))))) |
| 182 | 182 | ||
| 183 | ;; Assert that only one date stamp per day appears in the server | ||
| 184 | ;; buffer when reconnecting. | ||
| 185 | (ert-deftest erc-scenarios-stamp--date-mode/reconnect () | ||
| 186 | :tags '(:expensive-test) | ||
| 187 | (erc-scenarios-common-with-cleanup | ||
| 188 | ((erc-scenarios-common-dialog "base/reconnect") | ||
| 189 | (erc-server-flood-penalty 0.1) | ||
| 190 | (erc-stamp--tz t) | ||
| 191 | (erc-server-auto-reconnect t) | ||
| 192 | ;; Start close to midnight: 2024-06-02T23:58:11.055Z | ||
| 193 | (erc-stamp--current-time (if (< emacs-major-version 29) | ||
| 194 | '(26205 1811 55000 0) | ||
| 195 | '(1717372691055 . 1000))) | ||
| 196 | (erc-insert-post-hook (cons (lambda () | ||
| 197 | (setq erc-stamp--current-time | ||
| 198 | (time-add erc-stamp--current-time 0.1))) | ||
| 199 | erc-insert-post-hook)) | ||
| 200 | (dumb-server (erc-d-run "localhost" t | ||
| 201 | 'unexpected-disconnect 'unexpected-disconnect)) | ||
| 202 | ;; Define overriding formatting function for catalog entry | ||
| 203 | ;; `disconnected' to spoof time progressing past midnight. | ||
| 204 | (erc-message-english-disconnected | ||
| 205 | (let ((orig erc-message-english-disconnected)) | ||
| 206 | (lambda (&rest _) | ||
| 207 | (setq erc-stamp--current-time | ||
| 208 | (time-add erc-stamp--current-time 120)) | ||
| 209 | orig))) | ||
| 210 | (port (process-contact dumb-server :service)) | ||
| 211 | (expect (erc-d-t-make-expecter))) | ||
| 212 | |||
| 213 | (ert-info ("Connect") | ||
| 214 | (with-current-buffer (erc :server "127.0.0.1" | ||
| 215 | :port port | ||
| 216 | :nick "tester" | ||
| 217 | :full-name "tester") | ||
| 218 | (funcall expect 10 "debug mode"))) | ||
| 219 | |||
| 220 | ;; Ensure date stamps are unique per server buffer. | ||
| 221 | (with-current-buffer "FooNet" | ||
| 222 | (funcall expect 10 "[Mon Jun 3 2024]") | ||
| 223 | (funcall expect -0.1 "[Mon Jun 3 2024]") ; no duplicates | ||
| 224 | (funcall expect 10 "[00:00]") | ||
| 225 | (funcall expect -0.1 "[00:00]") | ||
| 226 | (funcall expect 10 "Welcome to the foonet") | ||
| 227 | (delete-process erc-server-process)))) | ||
| 228 | |||
| 183 | ;;; erc-scenarios-stamp.el ends here | 229 | ;;; erc-scenarios-stamp.el ends here |