diff options
| author | F. Jason Park | 2022-05-24 06:41:40 -0700 |
|---|---|---|
| committer | F. Jason Park | 2022-05-24 18:26:49 -0700 |
| commit | 4d60dcd87c72f7b96cac04233ffb253bd79f5bb1 (patch) | |
| tree | 02c4d631ac08eacfb412b1e99b6d0276c5a538bf /test | |
| parent | 0f1e1a94a0957da6a8551d48f43336060e46fa87 (diff) | |
| download | emacs-4d60dcd87c72f7b96cac04233ffb253bd79f5bb1.tar.gz emacs-4d60dcd87c72f7b96cac04233ffb253bd79f5bb1.zip | |
; 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.
Diffstat (limited to 'test')
| -rw-r--r-- | test/lisp/erc/erc-dcc-tests.el | 76 |
1 files changed, 39 insertions, 37 deletions
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 @@ | |||
| 49 | ;; `erc-dcc-do-LIST-command' | 49 | ;; `erc-dcc-do-LIST-command' |
| 50 | 50 | ||
| 51 | (defun erc-dcc-tests--dcc-handle-ctcp-send (turbo) | 51 | (defun erc-dcc-tests--dcc-handle-ctcp-send (turbo) |
| 52 | (with-current-buffer (get-buffer-create "fake-server") | 52 | (let (erc-send-completed-hook |
| 53 | (erc-mode) | 53 | erc-insert-modify-hook |
| 54 | (setq erc-server-process | 54 | erc-kill-channel-hook erc-kill-server-hook erc-kill-buffer-hook) |
| 55 | (start-process "fake" (current-buffer) "sleep" "10") | 55 | (with-current-buffer (get-buffer-create "fake-server") |
| 56 | erc-input-marker (make-marker) | 56 | (erc-mode) |
| 57 | erc-insert-marker (make-marker) | 57 | (setq erc-server-process |
| 58 | erc-server-current-nick "dummy") | 58 | (start-process "fake" (current-buffer) "sleep" "10") |
| 59 | (set-process-query-on-exit-flag erc-server-process nil) | 59 | erc-input-marker (make-marker) |
| 60 | (should-not erc-dcc-list) | 60 | erc-insert-marker (make-marker) |
| 61 | (erc-ctcp-query-DCC erc-server-process | 61 | erc-server-current-nick "dummy") |
| 62 | "tester" | 62 | (set-process-query-on-exit-flag erc-server-process nil) |
| 63 | "~tester" | 63 | (should-not erc-dcc-list) |
| 64 | "fake.irc" | 64 | (erc-ctcp-query-DCC erc-server-process |
| 65 | "dummy" | 65 | "tester" |
| 66 | (concat "DCC " (if turbo "TSEND" "SEND") | 66 | "~tester" |
| 67 | " foo 2130706433 9899 1405135128")) | 67 | "fake.irc" |
| 68 | (should-not (cdr erc-dcc-list)) | 68 | "dummy" |
| 69 | (should (equal (plist-put (car erc-dcc-list) :parent 'fake) | 69 | (concat "DCC " (if turbo "TSEND" "SEND") |
| 70 | `(:nick "tester!~tester@fake.irc" | 70 | " foo 2130706433 9899 1405135128")) |
| 71 | :type GET | 71 | (should-not (cdr erc-dcc-list)) |
| 72 | :peer nil | 72 | (should (equal (plist-put (car erc-dcc-list) :parent 'fake) |
| 73 | :parent fake | 73 | `(:nick "tester!~tester@fake.irc" |
| 74 | :ip "127.0.0.1" | 74 | :type GET |
| 75 | :port "9899" | 75 | :peer nil |
| 76 | :file "foo" | 76 | :parent fake |
| 77 | :size 1405135128 | 77 | :ip "127.0.0.1" |
| 78 | :turbo ,(and turbo t) | 78 | :port "9899" |
| 79 | :secure nil))) | 79 | :file "foo" |
| 80 | (goto-char (point-min)) | 80 | :size 1405135128 |
| 81 | (should (search-forward "file foo offered by tester" nil t)) | 81 | :turbo ,(and turbo t) |
| 82 | (erc-dcc-do-LIST-command erc-server-process) | 82 | :secure nil))) |
| 83 | (should (search-forward-regexp (concat | 83 | (goto-char (point-min)) |
| 84 | "GET +no +1405135128 +foo" | 84 | (should (search-forward "file foo offered by tester" nil t)) |
| 85 | (and turbo " +(T)") "$") | 85 | (erc-dcc-do-LIST-command erc-server-process) |
| 86 | nil t)) | 86 | (should (search-forward-regexp (concat |
| 87 | (when noninteractive | 87 | "GET +no +1405135128 +foo" |
| 88 | (let (erc-kill-channel-hook erc-kill-server-hook erc-kill-buffer-hook) | 88 | (and turbo " +(T)") "$") |
| 89 | nil t)) | ||
| 90 | (when noninteractive | ||
| 89 | (kill-buffer)))) | 91 | (kill-buffer)))) |
| 90 | ;; `erc-dcc-list' is global; must leave it empty | 92 | ;; `erc-dcc-list' is global; must leave it empty |
| 91 | (should erc-dcc-list) | 93 | (should erc-dcc-list) |