summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorF. Jason Park <jp@neverwas.me>2023-02-19 21:33:36 -0800
committerF. Jason Park <jp@neverwas.me>2023-04-08 14:23:51 -0700
commit05f6fdb9e7893329baff675bd31fb36ad64c756d (patch)
tree6228f6feb7b97e20a72231cc49ef5fa642246aa0 /test
parente7992d2adbc50ba8a3b0fb18b9afe22a2a539b1d (diff)
downloademacs-05f6fdb9e7893329baff675bd31fb36ad64c756d.tar.gz
Preserve ERC prompt and its bounding markers
* lisp/erc/erc.el (erc--assert-input-bounds): Add possibly temporary helper function to sync `process-mark' to `erc-insert-marker' in server buffer. (erc-display-line-1): Expect `erc-insert-marker' to always be initialized. Assert some essential invariants regarding insert markers. (erc-send-current-line): Delete typed input but not the prompt. (erc-display-msg): Rework slightly to respect existing markers. * test/lisp/erc/erc-dcc-tests.el (erc-dcc-tests--dcc-handle-ctcp-send): Set insert marker. * test/lisp/erc/erc-networks-tests.el (erc-networks--rename-server-buffer--existing-live): Initialize markers to appease `erc--assert-input-bounds'. * test/lisp/erc/erc-tests.el (erc-ring-previous-command): Fix sloppy mock. (Bug#60936.)
Diffstat (limited to 'test')
-rw-r--r--test/lisp/erc/erc-dcc-tests.el2
-rw-r--r--test/lisp/erc/erc-networks-tests.el10
-rw-r--r--test/lisp/erc/erc-tests.el4
3 files changed, 12 insertions, 4 deletions
diff --git a/test/lisp/erc/erc-dcc-tests.el b/test/lisp/erc/erc-dcc-tests.el
index fed86eff2c5..7fb5f82e784 100644
--- a/test/lisp/erc/erc-dcc-tests.el
+++ b/test/lisp/erc/erc-dcc-tests.el
@@ -60,6 +60,8 @@
erc-input-marker (make-marker)
erc-insert-marker (make-marker)
erc-server-current-nick "dummy")
+ (erc-display-prompt)
+ (set-marker erc-insert-marker (pos-bol))
(set-process-query-on-exit-flag erc-server-process nil)
(should-not erc-dcc-list)
(erc-ctcp-query-DCC erc-server-process
diff --git a/test/lisp/erc/erc-networks-tests.el b/test/lisp/erc/erc-networks-tests.el
index 96836c29aed..b9d216f217b 100644
--- a/test/lisp/erc/erc-networks-tests.el
+++ b/test/lisp/erc/erc-networks-tests.el
@@ -1475,10 +1475,16 @@
(erc-mode)
(setq erc-network 'FooNet
erc-server-current-nick "tester"
- erc-insert-marker (set-marker (make-marker) (point-max))
+ erc-insert-marker (make-marker)
+ erc-input-marker (make-marker)
erc-server-process (erc-networks-tests--create-live-proc)
erc-networks--id (erc-networks--id-create nil))
- (should-not (erc-networks--rename-server-buffer erc-server-process))
+ (set-process-sentinel erc-server-process #'ignore)
+ (erc-display-prompt nil (point-max))
+ (set-marker erc-insert-marker (pos-bol))
+ (erc-display-message nil 'notice (current-buffer) "notice")
+ (with-silent-modifications
+ (should-not (erc-networks--rename-server-buffer erc-server-process)))
(should (eq erc-active-buffer old-buf))
(should-not (erc-server-process-alive))
(should (string= (buffer-name) "irc.foonet.org"))
diff --git a/test/lisp/erc/erc-tests.el b/test/lisp/erc/erc-tests.el
index 795864a2cc2..b2f24aa718e 100644
--- a/test/lisp/erc/erc-tests.el
+++ b/test/lisp/erc/erc-tests.el
@@ -559,8 +559,8 @@
;;
(cl-letf (((symbol-function 'erc-process-input-line)
(lambda (&rest _)
- (insert-before-markers
- (erc-display-message-highlight 'notice "echo: one\n"))))
+ (erc-display-message
+ nil 'notice (current-buffer) "echo: one\n")))
((symbol-function 'erc-command-no-process-p)
(lambda (&rest _) t)))
(ert-info ("Create ring, populate, recall")