From: F. Jason Park Date: Tue, 24 May 2022 13:41:40 +0000 (-0700) Subject: ; Fix inevitable failure in erc-dcc test X-Git-Tag: emacs-29.0.90~1910^2~442 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=4d60dcd87c72f7b96cac04233ffb253bd79f5bb1;p=emacs.git ; Fix inevitable failure in erc-dcc test * test/lisp/erc/erc-dcc-tests.el (erc-dcc-tests--dcc-handle-ctcp-send): Shadow hook to prevent the erc-button module from interfering with tests that use this helper. --- diff --git a/test/lisp/erc/erc-dcc-tests.el b/test/lisp/erc/erc-dcc-tests.el index a10cbfc02c0..a1dfbab9dc5 100644 --- a/test/lisp/erc/erc-dcc-tests.el +++ b/test/lisp/erc/erc-dcc-tests.el @@ -49,43 +49,45 @@ ;; `erc-dcc-do-LIST-command' (defun erc-dcc-tests--dcc-handle-ctcp-send (turbo) - (with-current-buffer (get-buffer-create "fake-server") - (erc-mode) - (setq erc-server-process - (start-process "fake" (current-buffer) "sleep" "10") - erc-input-marker (make-marker) - erc-insert-marker (make-marker) - erc-server-current-nick "dummy") - (set-process-query-on-exit-flag erc-server-process nil) - (should-not erc-dcc-list) - (erc-ctcp-query-DCC erc-server-process - "tester" - "~tester" - "fake.irc" - "dummy" - (concat "DCC " (if turbo "TSEND" "SEND") - " foo 2130706433 9899 1405135128")) - (should-not (cdr erc-dcc-list)) - (should (equal (plist-put (car erc-dcc-list) :parent 'fake) - `(:nick "tester!~tester@fake.irc" - :type GET - :peer nil - :parent fake - :ip "127.0.0.1" - :port "9899" - :file "foo" - :size 1405135128 - :turbo ,(and turbo t) - :secure nil))) - (goto-char (point-min)) - (should (search-forward "file foo offered by tester" nil t)) - (erc-dcc-do-LIST-command erc-server-process) - (should (search-forward-regexp (concat - "GET +no +1405135128 +foo" - (and turbo " +(T)") "$") - nil t)) - (when noninteractive - (let (erc-kill-channel-hook erc-kill-server-hook erc-kill-buffer-hook) + (let (erc-send-completed-hook + erc-insert-modify-hook + erc-kill-channel-hook erc-kill-server-hook erc-kill-buffer-hook) + (with-current-buffer (get-buffer-create "fake-server") + (erc-mode) + (setq erc-server-process + (start-process "fake" (current-buffer) "sleep" "10") + erc-input-marker (make-marker) + erc-insert-marker (make-marker) + erc-server-current-nick "dummy") + (set-process-query-on-exit-flag erc-server-process nil) + (should-not erc-dcc-list) + (erc-ctcp-query-DCC erc-server-process + "tester" + "~tester" + "fake.irc" + "dummy" + (concat "DCC " (if turbo "TSEND" "SEND") + " foo 2130706433 9899 1405135128")) + (should-not (cdr erc-dcc-list)) + (should (equal (plist-put (car erc-dcc-list) :parent 'fake) + `(:nick "tester!~tester@fake.irc" + :type GET + :peer nil + :parent fake + :ip "127.0.0.1" + :port "9899" + :file "foo" + :size 1405135128 + :turbo ,(and turbo t) + :secure nil))) + (goto-char (point-min)) + (should (search-forward "file foo offered by tester" nil t)) + (erc-dcc-do-LIST-command erc-server-process) + (should (search-forward-regexp (concat + "GET +no +1405135128 +foo" + (and turbo " +(T)") "$") + nil t)) + (when noninteractive (kill-buffer)))) ;; `erc-dcc-list' is global; must leave it empty (should erc-dcc-list)