aboutsummaryrefslogtreecommitdiffstats
path: root/test/lisp
diff options
context:
space:
mode:
authorAndrea Corallo2024-02-28 20:47:57 +0100
committerAndrea Corallo2024-02-28 20:47:57 +0100
commit1fbe56c32761efdc8d268df80a97a9102d00e109 (patch)
tree8d8e76c8ae43c79ef9d76b0f97c12607567664b9 /test/lisp
parent6de60f33ed5cc438e20400aee83e1e2032773811 (diff)
parent05195e129fc933db32c9e08a155a94bfa4d75b54 (diff)
downloademacs-1fbe56c32761efdc8d268df80a97a9102d00e109.tar.gz
emacs-1fbe56c32761efdc8d268df80a97a9102d00e109.zip
Merge remote-tracking branch 'origin/master' into 'feature/type-hierarchy'
Diffstat (limited to 'test/lisp')
-rw-r--r--test/lisp/abbrev-tests.el4
-rw-r--r--test/lisp/auth-source-tests.el139
-rw-r--r--test/lisp/completion-preview-tests.el15
-rw-r--r--test/lisp/emacs-lisp/bytecomp-tests.el16
-rw-r--r--test/lisp/emacs-lisp/cl-generic-tests.el14
-rw-r--r--test/lisp/emacs-lisp/edebug-tests.el22
-rw-r--r--test/lisp/emacs-lisp/eieio-tests/eieio-tests.el28
-rw-r--r--test/lisp/emacs-lisp/hierarchy-tests.el5
-rw-r--r--test/lisp/emacs-lisp/macroexp-resources/vk.el2
-rw-r--r--test/lisp/erc/erc-button-tests.el3
-rw-r--r--test/lisp/erc/erc-fill-tests.el5
-rw-r--r--test/lisp/erc/erc-goodies-tests.el4
-rw-r--r--test/lisp/erc/erc-networks-tests.el47
-rw-r--r--test/lisp/erc/erc-scenarios-base-renick.el8
-rw-r--r--test/lisp/erc/erc-scenarios-base-upstream-recon-znc.el46
-rw-r--r--test/lisp/erc/erc-scenarios-misc-commands.el90
-rw-r--r--test/lisp/erc/erc-scenarios-misc.el2
-rw-r--r--test/lisp/erc/erc-stamp-tests.el10
-rw-r--r--test/lisp/erc/erc-tests.el81
-rw-r--r--test/lisp/erc/resources/base/upstream-reconnect/znc-severed.eld87
-rw-r--r--test/lisp/erc/resources/commands/amsg-barnet.eld54
-rw-r--r--test/lisp/erc/resources/commands/amsg-foonet.eld56
-rw-r--r--test/lisp/erc/resources/erc-scenarios-common.el5
-rw-r--r--test/lisp/erc/resources/erc-tests-common.el2
-rw-r--r--test/lisp/eshell/esh-opt-tests.el24
-rw-r--r--test/lisp/eshell/eshell-tests.el2
-rw-r--r--test/lisp/filenotify-tests.el53
-rw-r--r--test/lisp/files-tests.el51
-rw-r--r--test/lisp/info-tests.el16
-rw-r--r--test/lisp/international/mule-tests.el4
-rw-r--r--test/lisp/minibuffer-tests.el7
-rw-r--r--test/lisp/net/tramp-archive-tests.el4
-rw-r--r--test/lisp/net/tramp-tests.el120
-rw-r--r--test/lisp/obarray-tests.el31
-rw-r--r--test/lisp/progmodes/java-ts-mode-resources/indent.erts31
-rw-r--r--test/lisp/progmodes/python-tests.el146
-rw-r--r--test/lisp/thingatpt-tests.el9
37 files changed, 961 insertions, 282 deletions
diff --git a/test/lisp/abbrev-tests.el b/test/lisp/abbrev-tests.el
index bfdfac8be1b..cdd1a7832d3 100644
--- a/test/lisp/abbrev-tests.el
+++ b/test/lisp/abbrev-tests.el
@@ -57,12 +57,10 @@
57(ert-deftest abbrev-make-abbrev-table-test () 57(ert-deftest abbrev-make-abbrev-table-test ()
58 ;; Table without properties: 58 ;; Table without properties:
59 (let ((table (make-abbrev-table))) 59 (let ((table (make-abbrev-table)))
60 (should (abbrev-table-p table)) 60 (should (abbrev-table-p table)))
61 (should (= (length table) obarray-default-size)))
62 ;; Table with one property 'foo with value 'bar: 61 ;; Table with one property 'foo with value 'bar:
63 (let ((table (make-abbrev-table '(foo bar)))) 62 (let ((table (make-abbrev-table '(foo bar))))
64 (should (abbrev-table-p table)) 63 (should (abbrev-table-p table))
65 (should (= (length table) obarray-default-size))
66 (should (eq (abbrev-table-get table 'foo) 'bar)))) 64 (should (eq (abbrev-table-get table 'foo) 'bar))))
67 65
68(ert-deftest abbrev--table-symbols-test () 66(ert-deftest abbrev--table-symbols-test ()
diff --git a/test/lisp/auth-source-tests.el b/test/lisp/auth-source-tests.el
index 0a3c1cce590..c091a7dd060 100644
--- a/test/lisp/auth-source-tests.el
+++ b/test/lisp/auth-source-tests.el
@@ -33,8 +33,8 @@
33(require 'secrets) 33(require 'secrets)
34 34
35(defun auth-source-ensure-ignored-backend (source) 35(defun auth-source-ensure-ignored-backend (source)
36 (auth-source-validate-backend source '((:source . "") 36 (auth-source-validate-backend source '((source . "")
37 (:type . ignore)))) 37 (type . ignore))))
38 38
39(defun auth-source-validate-backend (source validation-alist) 39(defun auth-source-validate-backend (source validation-alist)
40 (let ((backend (auth-source-backend-parse source))) 40 (let ((backend (auth-source-backend-parse source)))
@@ -44,84 +44,101 @@
44 44
45(ert-deftest auth-source-backend-parse-macos-keychain () 45(ert-deftest auth-source-backend-parse-macos-keychain ()
46 (auth-source-validate-backend '(:source (:macos-keychain-generic foobar)) 46 (auth-source-validate-backend '(:source (:macos-keychain-generic foobar))
47 '((:source . "foobar") 47 '((source . "foobar")
48 (:type . macos-keychain-generic) 48 (type . macos-keychain-generic)
49 (:search-function . auth-source-macos-keychain-search) 49 (search-function . auth-source-macos-keychain-search)
50 (:create-function . auth-source-macos-keychain-create)))) 50 (create-function . auth-source-macos-keychain-create))))
51 51
52(ert-deftest auth-source-backend-parse-macos-keychain-generic-string () 52(ert-deftest auth-source-backend-parse-macos-keychain-generic-string ()
53 (auth-source-validate-backend "macos-keychain-generic:foobar" 53 (auth-source-validate-backend "macos-keychain-generic:foobar"
54 '((:source . "foobar") 54 '((source . "foobar")
55 (:type . macos-keychain-generic) 55 (type . macos-keychain-generic)
56 (:search-function . auth-source-macos-keychain-search) 56 (search-function
57 (:create-function . auth-source-macos-keychain-create)))) 57 . auth-source-macos-keychain-search)
58 (create-function
59 . auth-source-macos-keychain-create))))
58 60
59(ert-deftest auth-source-backend-parse-macos-keychain-internet-string () 61(ert-deftest auth-source-backend-parse-macos-keychain-internet-string ()
60 (auth-source-validate-backend "macos-keychain-internet:foobar" 62 (auth-source-validate-backend "macos-keychain-internet:foobar"
61 '((:source . "foobar") 63 '((source . "foobar")
62 (:type . macos-keychain-internet) 64 (type . macos-keychain-internet)
63 (:search-function . auth-source-macos-keychain-search) 65 (search-function
64 (:create-function . auth-source-macos-keychain-create)))) 66 . auth-source-macos-keychain-search)
67 (create-function
68 . auth-source-macos-keychain-create))))
65 69
66(ert-deftest auth-source-backend-parse-macos-keychain-internet-symbol () 70(ert-deftest auth-source-backend-parse-macos-keychain-internet-symbol ()
67 (auth-source-validate-backend 'macos-keychain-internet 71 (auth-source-validate-backend 'macos-keychain-internet
68 '((:source . "default") 72 '((source . "default")
69 (:type . macos-keychain-internet) 73 (type . macos-keychain-internet)
70 (:search-function . auth-source-macos-keychain-search) 74 (search-function
71 (:create-function . auth-source-macos-keychain-create)))) 75 . auth-source-macos-keychain-search)
76 (create-function
77 . auth-source-macos-keychain-create))))
72 78
73(ert-deftest auth-source-backend-parse-macos-keychain-generic-symbol () 79(ert-deftest auth-source-backend-parse-macos-keychain-generic-symbol ()
74 (auth-source-validate-backend 'macos-keychain-generic 80 (auth-source-validate-backend 'macos-keychain-generic
75 '((:source . "default") 81 '((source . "default")
76 (:type . macos-keychain-generic) 82 (type . macos-keychain-generic)
77 (:search-function . auth-source-macos-keychain-search) 83 (search-function
78 (:create-function . auth-source-macos-keychain-create)))) 84 . auth-source-macos-keychain-search)
85 (create-function
86 . auth-source-macos-keychain-create))))
79 87
80(ert-deftest auth-source-backend-parse-macos-keychain-internet-default-string () 88(ert-deftest auth-source-backend-parse-macos-keychain-internet-default-string ()
81 (auth-source-validate-backend 'macos-keychain-internet 89 (auth-source-validate-backend 'macos-keychain-internet
82 '((:source . "default") 90 '((source . "default")
83 (:type . macos-keychain-internet) 91 (type . macos-keychain-internet)
84 (:search-function . auth-source-macos-keychain-search) 92 (search-function
85 (:create-function . auth-source-macos-keychain-create)))) 93 . auth-source-macos-keychain-search)
94 (create-function
95 . auth-source-macos-keychain-create))))
86 96
87(ert-deftest auth-source-backend-parse-plstore () 97(ert-deftest auth-source-backend-parse-plstore ()
88 (auth-source-validate-backend '(:source "foo.plist") 98 (auth-source-validate-backend '(:source "foo.plist")
89 '((:source . "foo.plist") 99 '((source . "foo.plist")
90 (:type . plstore) 100 (type . plstore)
91 (:search-function . auth-source-plstore-search) 101 (search-function . auth-source-plstore-search)
92 (:create-function . auth-source-plstore-create)))) 102 (create-function
103 . auth-source-plstore-create))))
93 104
94(ert-deftest auth-source-backend-parse-netrc () 105(ert-deftest auth-source-backend-parse-netrc ()
95 (auth-source-validate-backend '(:source "foo") 106 (auth-source-validate-backend '(:source "foo")
96 '((:source . "foo") 107 '((source . "foo")
97 (:type . netrc) 108 (type . netrc)
98 (:search-function . auth-source-netrc-search) 109 (search-function . auth-source-netrc-search)
99 (:create-function . auth-source-netrc-create)))) 110 (create-function
111 . auth-source-netrc-create))))
100 112
101(ert-deftest auth-source-backend-parse-netrc-string () 113(ert-deftest auth-source-backend-parse-netrc-string ()
102 (auth-source-validate-backend "foo" 114 (auth-source-validate-backend "foo"
103 '((:source . "foo") 115 '((source . "foo")
104 (:type . netrc) 116 (type . netrc)
105 (:search-function . auth-source-netrc-search) 117 (search-function . auth-source-netrc-search)
106 (:create-function . auth-source-netrc-create)))) 118 (create-function
119 . auth-source-netrc-create))))
107 120
108(ert-deftest auth-source-backend-parse-secrets () 121(ert-deftest auth-source-backend-parse-secrets ()
109 (provide 'secrets) ; simulates the presence of the `secrets' package 122 (provide 'secrets) ; simulates the presence of the `secrets' package
110 (let ((secrets-enabled t)) 123 (let ((secrets-enabled t))
111 (auth-source-validate-backend '(:source (:secrets "foo")) 124 (auth-source-validate-backend '(:source (:secrets "foo"))
112 '((:source . "foo") 125 '((source . "foo")
113 (:type . secrets) 126 (type . secrets)
114 (:search-function . auth-source-secrets-search) 127 (search-function
115 (:create-function . auth-source-secrets-create))))) 128 . auth-source-secrets-search)
129 (create-function
130 . auth-source-secrets-create)))))
116 131
117(ert-deftest auth-source-backend-parse-secrets-strings () 132(ert-deftest auth-source-backend-parse-secrets-strings ()
118 (provide 'secrets) ; simulates the presence of the `secrets' package 133 (provide 'secrets) ; simulates the presence of the `secrets' package
119 (let ((secrets-enabled t)) 134 (let ((secrets-enabled t))
120 (auth-source-validate-backend "secrets:foo" 135 (auth-source-validate-backend "secrets:foo"
121 '((:source . "foo") 136 '((source . "foo")
122 (:type . secrets) 137 (type . secrets)
123 (:search-function . auth-source-secrets-search) 138 (search-function
124 (:create-function . auth-source-secrets-create))))) 139 . auth-source-secrets-search)
140 (create-function
141 . auth-source-secrets-create)))))
125 142
126(ert-deftest auth-source-backend-parse-secrets-alias () 143(ert-deftest auth-source-backend-parse-secrets-alias ()
127 (provide 'secrets) ; simulates the presence of the `secrets' package 144 (provide 'secrets) ; simulates the presence of the `secrets' package
@@ -129,10 +146,12 @@
129 ;; Redefine `secrets-get-alias' to map 'foo to "foo" 146 ;; Redefine `secrets-get-alias' to map 'foo to "foo"
130 (cl-letf (((symbol-function 'secrets-get-alias) (lambda (_) "foo"))) 147 (cl-letf (((symbol-function 'secrets-get-alias) (lambda (_) "foo")))
131 (auth-source-validate-backend '(:source (:secrets foo)) 148 (auth-source-validate-backend '(:source (:secrets foo))
132 '((:source . "foo") 149 '((source . "foo")
133 (:type . secrets) 150 (type . secrets)
134 (:search-function . auth-source-secrets-search) 151 (search-function
135 (:create-function . auth-source-secrets-create)))))) 152 . auth-source-secrets-search)
153 (create-function
154 . auth-source-secrets-create))))))
136 155
137(ert-deftest auth-source-backend-parse-secrets-symbol () 156(ert-deftest auth-source-backend-parse-secrets-symbol ()
138 (provide 'secrets) ; simulates the presence of the `secrets' package 157 (provide 'secrets) ; simulates the presence of the `secrets' package
@@ -140,10 +159,12 @@
140 ;; Redefine `secrets-get-alias' to map 'default to "foo" 159 ;; Redefine `secrets-get-alias' to map 'default to "foo"
141 (cl-letf (((symbol-function 'secrets-get-alias) (lambda (_) "foo"))) 160 (cl-letf (((symbol-function 'secrets-get-alias) (lambda (_) "foo")))
142 (auth-source-validate-backend 'default 161 (auth-source-validate-backend 'default
143 '((:source . "foo") 162 '((source . "foo")
144 (:type . secrets) 163 (type . secrets)
145 (:search-function . auth-source-secrets-search) 164 (search-function
146 (:create-function . auth-source-secrets-create)))))) 165 . auth-source-secrets-search)
166 (create-function
167 . auth-source-secrets-create))))))
147 168
148(ert-deftest auth-source-backend-parse-secrets-no-alias () 169(ert-deftest auth-source-backend-parse-secrets-no-alias ()
149 (provide 'secrets) ; simulates the presence of the `secrets' package 170 (provide 'secrets) ; simulates the presence of the `secrets' package
@@ -152,10 +173,12 @@
152 ;; "Login" is used by default 173 ;; "Login" is used by default
153 (cl-letf (((symbol-function 'secrets-get-alias) (lambda (_) nil))) 174 (cl-letf (((symbol-function 'secrets-get-alias) (lambda (_) nil)))
154 (auth-source-validate-backend '(:source (:secrets foo)) 175 (auth-source-validate-backend '(:source (:secrets foo))
155 '((:source . "Login") 176 '((source . "Login")
156 (:type . secrets) 177 (type . secrets)
157 (:search-function . auth-source-secrets-search) 178 (search-function
158 (:create-function . auth-source-secrets-create)))))) 179 . auth-source-secrets-search)
180 (create-function
181 . auth-source-secrets-create))))))
159 182
160(ert-deftest auth-source-backend-parse-invalid-or-nil-source () 183(ert-deftest auth-source-backend-parse-invalid-or-nil-source ()
161 (provide 'secrets) ; simulates the presence of the `secrets' package 184 (provide 'secrets) ; simulates the presence of the `secrets' package
diff --git a/test/lisp/completion-preview-tests.el b/test/lisp/completion-preview-tests.el
index 190764e9125..5b2c28bd3dd 100644
--- a/test/lisp/completion-preview-tests.el
+++ b/test/lisp/completion-preview-tests.el
@@ -181,4 +181,19 @@ instead."
181 (completion-preview--post-command)) 181 (completion-preview--post-command))
182 (completion-preview-tests--check-preview "barbaz" 'exact))) 182 (completion-preview-tests--check-preview "barbaz" 'exact)))
183 183
184(ert-deftest completion-preview-mid-symbol-cycle ()
185 "Test cycling the completion preview with point at the middle of a symbol."
186 (with-temp-buffer
187 (setq-local completion-at-point-functions
188 (list
189 (completion-preview-tests--capf
190 '("foobar" "foobaz"))))
191 (insert "fooba")
192 (forward-char -2)
193 (let ((this-command 'self-insert-command))
194 (completion-preview--post-command))
195 (completion-preview-tests--check-preview "r")
196 (completion-preview-next-candidate 1)
197 (completion-preview-tests--check-preview "z")))
198
184;;; completion-preview-tests.el ends here 199;;; completion-preview-tests.el ends here
diff --git a/test/lisp/emacs-lisp/bytecomp-tests.el b/test/lisp/emacs-lisp/bytecomp-tests.el
index dcb72e4105a..8ccac492141 100644
--- a/test/lisp/emacs-lisp/bytecomp-tests.el
+++ b/test/lisp/emacs-lisp/bytecomp-tests.el
@@ -848,6 +848,22 @@ byte-compiled. Run with dynamic binding."
848 (should (equal (bytecomp-tests--eval-interpreted form) 848 (should (equal (bytecomp-tests--eval-interpreted form)
849 (bytecomp-tests--eval-compiled form))))))) 849 (bytecomp-tests--eval-compiled form)))))))
850 850
851(ert-deftest bytecomp--fun-value-as-head ()
852 ;; Check that (FUN-VALUE ...) is a valid call, for compatibility (bug#68931).
853 ;; (There is also a warning but this test does not check that.)
854 (dolist (lb '(nil t))
855 (ert-info ((prin1-to-string lb) :prefix "lexical-binding: ")
856 (let* ((lexical-binding lb)
857 (s-int '(lambda (x) (1+ x)))
858 (s-comp (byte-compile s-int))
859 (v-int (lambda (x) (1+ x)))
860 (v-comp (byte-compile v-int))
861 (comp (lambda (f) (funcall (byte-compile `(lambda () (,f 3)))))))
862 (should (equal (funcall comp s-int) 4))
863 (should (equal (funcall comp s-comp) 4))
864 (should (equal (funcall comp v-int) 4))
865 (should (equal (funcall comp v-comp) 4))))))
866
851(defmacro bytecomp-tests--with-fresh-warnings (&rest body) 867(defmacro bytecomp-tests--with-fresh-warnings (&rest body)
852 `(let ((macroexp--warned ; oh dear 868 `(let ((macroexp--warned ; oh dear
853 (make-hash-table :test #'equal :weakness 'key))) 869 (make-hash-table :test #'equal :weakness 'key)))
diff --git a/test/lisp/emacs-lisp/cl-generic-tests.el b/test/lisp/emacs-lisp/cl-generic-tests.el
index 086ac399352..990fa580c54 100644
--- a/test/lisp/emacs-lisp/cl-generic-tests.el
+++ b/test/lisp/emacs-lisp/cl-generic-tests.el
@@ -319,5 +319,19 @@ Edebug symbols (Bug#42672)."
319 (and (eq 'error (car err)) 319 (and (eq 'error (car err))
320 (string-match "Stray.*declare" (cadr err))))))) 320 (string-match "Stray.*declare" (cadr err)))))))
321 321
322(cl-defmethod cl-generic-tests--print-quoted-method ((function (eql '4)))
323 (+ function 1))
324
325(ert-deftest cl-generic-tests--print-quoted ()
326 (with-temp-buffer
327 (cl--generic-describe 'cl-generic-tests--print-quoted-method)
328 (goto-char (point-min))
329 ;; Bug#54628: We don't want (function (eql '4)) to turn into #'(eql '4)
330 (should-not (re-search-forward "#'" nil t))
331 (goto-char (point-min))
332 ;; But we don't want (eql '4) to turn into (eql (quote 4)) either.
333 (should (re-search-forward "(eql '4)" nil t))))
334
335
322(provide 'cl-generic-tests) 336(provide 'cl-generic-tests)
323;;; cl-generic-tests.el ends here 337;;; cl-generic-tests.el ends here
diff --git a/test/lisp/emacs-lisp/edebug-tests.el b/test/lisp/emacs-lisp/edebug-tests.el
index 8c0f729dc39..29adbcff947 100644
--- a/test/lisp/emacs-lisp/edebug-tests.el
+++ b/test/lisp/emacs-lisp/edebug-tests.el
@@ -860,8 +860,7 @@ test and possibly others should be updated."
860 (let ((inhibit-read-only t)) 860 (let ((inhibit-read-only t))
861 (delete-region (point-min) (point-max)) 861 (delete-region (point-min) (point-max))
862 (insert "`1")) 862 (insert "`1"))
863 (with-suppressed-warnings ((obsolete edebug-eval-defun)) 863 (eval-defun nil)
864 (edebug-eval-defun nil))
865 ;; `eval-defun' outputs its message to the echo area in a rather 864 ;; `eval-defun' outputs its message to the echo area in a rather
866 ;; funny way, so the "1" and the " (#o1, #x1, ?\C-a)" end up placed 865 ;; funny way, so the "1" and the " (#o1, #x1, ?\C-a)" end up placed
867 ;; there in separate pieces (via `print' rather than via `message'). 866 ;; there in separate pieces (via `print' rather than via `message').
@@ -871,18 +870,21 @@ test and possibly others should be updated."
871 870
872 (setq edebug-initial-mode 'go) 871 (setq edebug-initial-mode 'go)
873 ;; In Bug#23651 Edebug would hang reading `1. 872 ;; In Bug#23651 Edebug would hang reading `1.
874 (with-suppressed-warnings ((obsolete edebug-eval-defun)) 873 (eval-defun t)
875 (edebug-eval-defun t)))) 874 (should (string-match-p (regexp-quote " (#o1, #x1, ?\\C-a)")
875 edebug-tests-messages))))
876 876
877(ert-deftest edebug-tests-trivial-comma () 877(ert-deftest edebug-tests-trivial-comma ()
878 "Edebug can read a trivial comma expression (Bug#23651)." 878 "Edebug can read a trivial comma expression (Bug#23651)."
879 (edebug-tests-with-normal-env 879 (edebug-tests-with-normal-env
880 (read-only-mode -1) 880 (let ((inhibit-read-only t))
881 (delete-region (point-min) (point-max)) 881 (delete-region (point-min) (point-max))
882 (insert ",1") 882 (insert ",1"))
883 (read-only-mode) 883 ;; FIXME: This currently signals a "Source has changed" error, which is
884 (with-suppressed-warnings ((obsolete edebug-eval-defun)) 884 ;; itself a bug (the source hasn't changed). All we're testing here
885 (should-error (edebug-eval-defun t))))) 885 ;; is that the Edebug gets past the step of reading the sexp.
886 (should-error (let ((eval-expression-debug-on-error nil))
887 (eval-defun t)))))
886 888
887(ert-deftest edebug-tests-circular-read-syntax () 889(ert-deftest edebug-tests-circular-read-syntax ()
888 "Edebug can instrument code using circular read object syntax (Bug#23660)." 890 "Edebug can instrument code using circular read object syntax (Bug#23660)."
diff --git a/test/lisp/emacs-lisp/eieio-tests/eieio-tests.el b/test/lisp/emacs-lisp/eieio-tests/eieio-tests.el
index 83fc476c911..bc226757ff2 100644
--- a/test/lisp/emacs-lisp/eieio-tests/eieio-tests.el
+++ b/test/lisp/emacs-lisp/eieio-tests/eieio-tests.el
@@ -1011,24 +1011,24 @@ Subclasses to override slot attributes."))
1011 (B (clone A :b "bb")) 1011 (B (clone A :b "bb"))
1012 (C (clone B :a "aa"))) 1012 (C (clone B :a "aa")))
1013 1013
1014 (should (string= "aa" (oref C :a))) 1014 (should (string= "aa" (oref C a)))
1015 (should (string= "bb" (oref C :b))) 1015 (should (string= "bb" (oref C b)))
1016 1016
1017 (should (slot-boundp A :a)) 1017 (should (slot-boundp A 'a))
1018 (should-not (slot-boundp A :b)) 1018 (should-not (slot-boundp A 'b))
1019 (should-not (slot-boundp A :c)) 1019 (should-not (slot-boundp A 'c))
1020 1020
1021 (should-not (slot-boundp B :a)) 1021 (should-not (slot-boundp B 'a))
1022 (should (slot-boundp B :b)) 1022 (should (slot-boundp B 'b))
1023 (should-not (slot-boundp A :c)) 1023 (should-not (slot-boundp A 'c))
1024 1024
1025 (should (slot-boundp C :a)) 1025 (should (slot-boundp C 'a))
1026 (should-not (slot-boundp C :b)) 1026 (should-not (slot-boundp C 'b))
1027 (should-not (slot-boundp C :c)) 1027 (should-not (slot-boundp C 'c))
1028 1028
1029 (should (eieio-instance-inheritor-slot-boundp C :a)) 1029 (should (eieio-instance-inheritor-slot-boundp C 'a))
1030 (should (eieio-instance-inheritor-slot-boundp C :b)) 1030 (should (eieio-instance-inheritor-slot-boundp C 'b))
1031 (should-not (eieio-instance-inheritor-slot-boundp C :c)))) 1031 (should-not (eieio-instance-inheritor-slot-boundp C 'c))))
1032 1032
1033;;;; Interaction with defstruct 1033;;;; Interaction with defstruct
1034 1034
diff --git a/test/lisp/emacs-lisp/hierarchy-tests.el b/test/lisp/emacs-lisp/hierarchy-tests.el
index 49c812edb05..3333f4014e6 100644
--- a/test/lisp/emacs-lisp/hierarchy-tests.el
+++ b/test/lisp/emacs-lisp/hierarchy-tests.el
@@ -570,8 +570,9 @@ should fail as this function will crash."
570 570
571(defun hierarchy-examples-delayed--childrenfn (hier-elem) 571(defun hierarchy-examples-delayed--childrenfn (hier-elem)
572 "Return the children of HIER-ELEM. 572 "Return the children of HIER-ELEM.
573Basically, feed the number, minus 1, to `hierarchy-examples-delayed--find-number' 573Basically, feed the number, minus 1, to
574and then create a list of the number plus 0.0–0.9." 574`hierarchy-examples-delayed--find-number' and then create a list of the
575number plus 0.0–0.9."
575 576
576 (when (> hier-elem 1) 577 (when (> hier-elem 1)
577 (let ((next (hierarchy-examples-delayed--find-number (1- hier-elem)))) 578 (let ((next (hierarchy-examples-delayed--find-number (1- hier-elem))))
diff --git a/test/lisp/emacs-lisp/macroexp-resources/vk.el b/test/lisp/emacs-lisp/macroexp-resources/vk.el
index 460b7a8e516..5358bcaeb5c 100644
--- a/test/lisp/emacs-lisp/macroexp-resources/vk.el
+++ b/test/lisp/emacs-lisp/macroexp-resources/vk.el
@@ -25,7 +25,7 @@
25 (if (macroexp--dynamic-variable-p var) ''dyn ''lex)) 25 (if (macroexp--dynamic-variable-p var) ''dyn ''lex))
26 26
27(defvar vk-a 1) 27(defvar vk-a 1)
28(defconst vk-b 2) 28(defvar vk-b 2)
29(defvar vk-c) 29(defvar vk-c)
30 30
31(defun vk-f1 (x) 31(defun vk-f1 (x)
diff --git a/test/lisp/erc/erc-button-tests.el b/test/lisp/erc/erc-button-tests.el
index ba6fe9fd8c1..603b3745a27 100644
--- a/test/lisp/erc/erc-button-tests.el
+++ b/test/lisp/erc/erc-button-tests.el
@@ -20,14 +20,13 @@
20;;; Commentary: 20;;; Commentary:
21 21
22;;; Code: 22;;; Code:
23(require 'erc-button)
23 24
24(require 'ert-x) ; cl-lib 25(require 'ert-x) ; cl-lib
25(eval-and-compile 26(eval-and-compile
26 (let ((load-path (cons (ert-resource-directory) load-path))) 27 (let ((load-path (cons (ert-resource-directory) load-path)))
27 (require 'erc-tests-common))) 28 (require 'erc-tests-common)))
28 29
29(require 'erc-button)
30
31(ert-deftest erc-button-alist--url () 30(ert-deftest erc-button-alist--url ()
32 (erc-tests-common-init-server-proc "sleep" "1") 31 (erc-tests-common-init-server-proc "sleep" "1")
33 (with-current-buffer (erc--open-target "#chan") 32 (with-current-buffer (erc--open-target "#chan")
diff --git a/test/lisp/erc/erc-fill-tests.el b/test/lisp/erc/erc-fill-tests.el
index 0f19b481f37..3c4ad04abd7 100644
--- a/test/lisp/erc/erc-fill-tests.el
+++ b/test/lisp/erc/erc-fill-tests.el
@@ -23,13 +23,13 @@
23;; scenarios. 23;; scenarios.
24 24
25;;; Code: 25;;; Code:
26(require 'erc-fill)
27
26(require 'ert-x) 28(require 'ert-x)
27(eval-and-compile 29(eval-and-compile
28 (let ((load-path (cons (ert-resource-directory) load-path))) 30 (let ((load-path (cons (ert-resource-directory) load-path)))
29 (require 'erc-tests-common))) 31 (require 'erc-tests-common)))
30 32
31(require 'erc-fill)
32
33(defvar erc-fill-tests--buffers nil) 33(defvar erc-fill-tests--buffers nil)
34(defvar erc-fill-tests--current-time-value nil) 34(defvar erc-fill-tests--current-time-value nil)
35 35
@@ -52,6 +52,7 @@
52 52
53(defun erc-fill-tests--wrap-populate (test) 53(defun erc-fill-tests--wrap-populate (test)
54 (let ((original-window-buffer (window-buffer (selected-window))) 54 (let ((original-window-buffer (window-buffer (selected-window)))
55 (erc--fill-wrap-scrolltobottom-exempt-p t)
55 (erc-stamp--tz t) 56 (erc-stamp--tz t)
56 (erc-fill-function 'erc-fill-wrap) 57 (erc-fill-function 'erc-fill-wrap)
57 (pre-command-hook pre-command-hook) 58 (pre-command-hook pre-command-hook)
diff --git a/test/lisp/erc/erc-goodies-tests.el b/test/lisp/erc/erc-goodies-tests.el
index 170e28bda96..7013ce0c8fc 100644
--- a/test/lisp/erc/erc-goodies-tests.el
+++ b/test/lisp/erc/erc-goodies-tests.el
@@ -19,13 +19,13 @@
19 19
20;;; Commentary: 20;;; Commentary:
21;;; Code: 21;;; Code:
22(require 'erc-goodies)
23
22(require 'ert-x) 24(require 'ert-x)
23(eval-and-compile 25(eval-and-compile
24 (let ((load-path (cons (ert-resource-directory) load-path))) 26 (let ((load-path (cons (ert-resource-directory) load-path)))
25 (require 'erc-tests-common))) 27 (require 'erc-tests-common)))
26 28
27(require 'erc-goodies)
28
29(defun erc-goodies-tests--assert-face (beg end-str present &optional absent) 29(defun erc-goodies-tests--assert-face (beg end-str present &optional absent)
30 (setq beg (+ beg (point-min))) 30 (setq beg (+ beg (point-min)))
31 (let ((end (+ beg (1- (length end-str))))) 31 (let ((end (+ beg (1- (length end-str)))))
diff --git a/test/lisp/erc/erc-networks-tests.el b/test/lisp/erc/erc-networks-tests.el
index d8d8c6fa9cd..90b8aa99741 100644
--- a/test/lisp/erc/erc-networks-tests.el
+++ b/test/lisp/erc/erc-networks-tests.el
@@ -18,6 +18,7 @@
18;; along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. 18;; along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
19 19
20;;; Code: 20;;; Code:
21(require 'erc-compat)
21 22
22(require 'ert-x) ; cl-lib 23(require 'ert-x) ; cl-lib
23(eval-and-compile 24(eval-and-compile
@@ -1761,4 +1762,50 @@
1761 (should (equal (erc-ports-list (nth 4 srv)) 1762 (should (equal (erc-ports-list (nth 4 srv))
1762 '(6697 9999)))))) 1763 '(6697 9999))))))
1763 1764
1765(ert-deftest erc-networks--examine-targets ()
1766 (with-current-buffer (erc-tests-common-make-server-buf "foonet")
1767 (erc--open-target "#chan")
1768 (erc--open-target "#spam"))
1769
1770 (with-current-buffer (erc-tests-common-make-server-buf "barnet")
1771 (with-current-buffer (erc--open-target "*query")
1772 (setq erc-networks--id nil))
1773 (with-current-buffer (erc--open-target "#chan")
1774 (let ((calls ())
1775 (snap (lambda (parameter)
1776 (list parameter
1777 (erc-target)
1778 (erc-networks--id-symbol erc-networks--id)))))
1779
1780 ;; Search for "#chan" dupes among targets of all servers.
1781 (should (equal
1782 (erc-networks--examine-targets erc-networks--id erc--target
1783 (lambda () (push (funcall snap 'ON-DUPE) calls))
1784 (lambda () (push (funcall snap 'ON-COLL) calls)))
1785 (list (get-buffer "#chan@foonet")
1786 (get-buffer "#chan@barnet"))))
1787
1788 (should (equal (pop calls) '(ON-DUPE "#chan" barnet)))
1789 (should (equal (pop calls) '(ON-COLL "#chan" foonet)))
1790 (should-not calls)
1791 (should-not (get-buffer "#chan"))
1792 (should (get-buffer "#chan@barnet"))
1793 (should (get-buffer "#chan@foonet"))
1794
1795 ;; Search for "*query" dupes among targets of all servers.
1796 (should (equal (erc-networks--examine-targets erc-networks--id
1797 (buffer-local-value 'erc--target
1798 (get-buffer "*query"))
1799 (lambda () (push (funcall snap 'ON-DUPE) calls))
1800 (lambda () (push (funcall snap 'ON-COLL) calls)))
1801 (list (get-buffer "*query"))))
1802
1803 (should (equal (pop calls) '(ON-DUPE "*query" barnet)))
1804 (should-not calls)))
1805
1806 (goto-char (point-min))
1807 (should (search-forward "Missing network session" nil t)))
1808
1809 (erc-tests-common-kill-buffers))
1810
1764;;; erc-networks-tests.el ends here 1811;;; erc-networks-tests.el ends here
diff --git a/test/lisp/erc/erc-scenarios-base-renick.el b/test/lisp/erc/erc-scenarios-base-renick.el
index ca22728b152..e0fcb8b9366 100644
--- a/test/lisp/erc/erc-scenarios-base-renick.el
+++ b/test/lisp/erc/erc-scenarios-base-renick.el
@@ -281,12 +281,12 @@
281 (should-not (get-buffer "rando@barnet")) 281 (should-not (get-buffer "rando@barnet"))
282 282
283 (with-current-buffer "frenemy@foonet" 283 (with-current-buffer "frenemy@foonet"
284 (funcall expect 1 "now known as") 284 (funcall expect 10 "now known as")
285 (funcall expect 1 "doubly so")) 285 (funcall expect 10 "doubly so"))
286 286
287 (with-current-buffer "frenemy@barnet" 287 (with-current-buffer "frenemy@barnet"
288 (funcall expect 1 "now known as") 288 (funcall expect 10 "now known as")
289 (funcall expect 1 "reality picture")) 289 (funcall expect 10 "reality picture"))
290 290
291 (when noninteractive 291 (when noninteractive
292 (with-current-buffer "frenemy@barnet" (kill-buffer)) 292 (with-current-buffer "frenemy@barnet" (kill-buffer))
diff --git a/test/lisp/erc/erc-scenarios-base-upstream-recon-znc.el b/test/lisp/erc/erc-scenarios-base-upstream-recon-znc.el
index bbd9c79f593..f3905974a11 100644
--- a/test/lisp/erc/erc-scenarios-base-upstream-recon-znc.el
+++ b/test/lisp/erc/erc-scenarios-base-upstream-recon-znc.el
@@ -42,4 +42,50 @@
42 'znc-foonet 42 'znc-foonet
43 'znc-barnet)) 43 'znc-barnet))
44 44
45;; Here, the upstream connection is already severed when first
46;; connecting. The bouncer therefore sends query messages from an
47;; administrative bot before the first numerics burst, which results
48;; in a target buffer not being associated with an `erc-networks--id'.
49;; The problem only manifests later, when the buffer-association
50;; machinery checks the names of all target buffers and assumes a
51;; non-nil `erc-networks--id'.
52(ert-deftest erc-scenarios-upstream-recon--znc/severed ()
53 (erc-scenarios-common-with-cleanup
54 ((erc-scenarios-common-dialog "base/upstream-reconnect")
55 (erc-d-t-cleanup-sleep-secs 1)
56 (erc-server-flood-penalty 0.1)
57 (dumb-server (erc-d-run "localhost" t 'znc-severed))
58 (port (process-contact dumb-server :service))
59 (expect (erc-d-t-make-expecter)))
60
61 (ert-info ("Connect to foonet")
62 (with-current-buffer (erc :server "127.0.0.1"
63 :port port
64 :nick "tester"
65 :user "tester@vanilla/foonet"
66 :password "changeme"
67 :full-name "tester")
68 (erc-scenarios-common-assert-initial-buf-name nil port)
69 (erc-d-t-wait-for 6 (eq (erc-network) 'foonet))))
70
71 (with-current-buffer (erc-d-t-wait-for 5 (get-buffer "*status"))
72 (funcall expect 10 "Connection Refused. Reconnecting...")
73 (funcall expect 10 "Connected!"))
74
75 (ert-info ("Join #chan")
76 (with-current-buffer (erc-d-t-wait-for 10 (get-buffer "#chan"))
77 (funcall expect 10 "<alice> tester, welcome!")
78 (funcall expect 10 "<bob> alice: And see a fearful sight")
79 (funcall expect 10 "<eve> hola")
80 (funcall expect 10 "<Evel> hell o")
81 ;;
82 (funcall expect 10 "<alice> bob: Or to drown my clothes")))
83
84 (ert-info ("Buffer not renamed with net id")
85 (should (get-buffer "*status")))
86
87 (ert-info ("No error")
88 (with-current-buffer (messages-buffer)
89 (funcall expect -0.1 "error in process filter")))))
90
45;;; erc-scenarios-base-upstream-recon-znc.el ends here 91;;; erc-scenarios-base-upstream-recon-znc.el ends here
diff --git a/test/lisp/erc/erc-scenarios-misc-commands.el b/test/lisp/erc/erc-scenarios-misc-commands.el
index d6ed53b5358..da6855caf57 100644
--- a/test/lisp/erc/erc-scenarios-misc-commands.el
+++ b/test/lisp/erc/erc-scenarios-misc-commands.el
@@ -123,4 +123,94 @@
123 (should (string= (erc-server-user-host (erc-get-server-user "tester")) 123 (should (string= (erc-server-user-host (erc-get-server-user "tester"))
124 "some.host.test.cc")))))) 124 "some.host.test.cc"))))))
125 125
126;; This tests four related slash commands, /AMSG, /GMSG, /AME, /GME,
127;; the latter three introduced by bug#68401. It mainly asserts
128;; correct routing behavior, especially not sending or inserting
129;; messages in buffers belonging to disconnected sessions. Left
130;; unaddressed are interactions with the `command-indicator' module
131;; (`erc-noncommands-list') and whatever future `echo-message'
132;; implementation manifests out of bug#49860.
133(ert-deftest erc-scenarios-misc-commands--AMSG-GMSG-AME-GME ()
134 (erc-scenarios-common-with-cleanup
135 ((erc-scenarios-common-dialog "commands")
136 (erc-server-flood-penalty 0.1)
137 (dumb-server-foonet (erc-d-run "localhost" t "srv-foonet" 'amsg-foonet))
138 (dumb-server-barnet (erc-d-run "localhost" t "srv-barnet" 'amsg-barnet))
139 (expect (erc-d-t-make-expecter)))
140
141 (ert-info ("Connect to foonet and join #foo")
142 (with-current-buffer
143 (erc :server "127.0.0.1"
144 :port (process-contact dumb-server-foonet :service)
145 :nick "tester")
146 (funcall expect 10 "debug mode")
147 (erc-cmd-JOIN "#foo")))
148
149 (ert-info ("Connect to barnet and join #bar")
150 (with-current-buffer
151 (erc :server "127.0.0.1"
152 :port (process-contact dumb-server-barnet :service)
153 :nick "tester")
154 (funcall expect 10 "debug mode")
155 (erc-cmd-JOIN "#bar")))
156
157 (with-current-buffer (erc-d-t-wait-for 10 (get-buffer "#foo"))
158 (funcall expect 10 "welcome"))
159 (with-current-buffer (erc-d-t-wait-for 10 (get-buffer "#bar"))
160 (funcall expect 10 "welcome"))
161
162 (ert-info ("/AMSG only sent to issuing context's server")
163 (with-current-buffer "foonet"
164 (erc-scenarios-common-say "/amsg 1 foonet only"))
165 (with-current-buffer "barnet"
166 (erc-scenarios-common-say "/amsg 2 barnet only"))
167 (with-current-buffer "#foo"
168 (funcall expect 10 "<tester> 1 foonet only")
169 (funcall expect 10 "<alice> bob: Our queen and all"))
170 (with-current-buffer "#bar"
171 (funcall expect 10 "<tester> 2 barnet only")
172 (funcall expect 10 "<joe> mike: And secretly to greet")))
173
174 (ert-info ("/AME only sent to issuing context's server")
175 (with-current-buffer "foonet"
176 (erc-scenarios-common-say "/ame 3 foonet only"))
177 (with-current-buffer "barnet"
178 (erc-scenarios-common-say "/ame 4 barnet only"))
179 (with-current-buffer "#foo"
180 (funcall expect 10 "* tester 3 foonet only")
181 (funcall expect 10 "<alice> bob: You have discharged this"))
182 (with-current-buffer "#bar"
183 (funcall expect 10 "* tester 4 barnet only")
184 (funcall expect 10 "<joe> mike: That same Berowne")))
185
186 (ert-info ("/GMSG and /GME sent to all servers")
187 (with-current-buffer "foonet"
188 (erc-scenarios-common-say "/gmsg 5 all nets")
189 (erc-scenarios-common-say "/gme 6 all nets"))
190 (with-current-buffer "#bar"
191 (funcall expect 10 "<tester> 5 all nets")
192 (funcall expect 10 "* tester 6 all nets")
193 (funcall expect 10 "<joe> mike: Mehercle! if their sons")))
194
195 (ert-info ("/GMSG and /GME only sent to connected servers")
196 (with-current-buffer "barnet"
197 (erc-cmd-QUIT "")
198 (funcall expect 10 "ERC finished"))
199 (with-current-buffer "#foo"
200 (funcall expect 10 "<tester> 5 all nets")
201 (funcall expect 10 "* tester 6 all nets")
202 (funcall expect 10 "<alice> bob: Stand you!"))
203 (with-current-buffer "foonet"
204 (erc-scenarios-common-say "/gmsg 7 all live nets")
205 (erc-scenarios-common-say "/gme 8 all live nets"))
206 ;; Message *not* inserted in disconnected buffer.
207 (with-current-buffer "#bar"
208 (funcall expect -0.1 "<tester> 7 all live nets")
209 (funcall expect -0.1 "* tester 8 all live nets")))
210
211 (with-current-buffer "#foo"
212 (funcall expect 10 "<tester> 7 all live nets")
213 (funcall expect 10 "* tester 8 all live nets")
214 (funcall expect 10 "<bob> alice: Live, and be prosperous;"))))
215
126;;; erc-scenarios-misc-commands.el ends here 216;;; erc-scenarios-misc-commands.el ends here
diff --git a/test/lisp/erc/erc-scenarios-misc.el b/test/lisp/erc/erc-scenarios-misc.el
index 8f6042de5c2..2afa1ce67a4 100644
--- a/test/lisp/erc/erc-scenarios-misc.el
+++ b/test/lisp/erc/erc-scenarios-misc.el
@@ -126,7 +126,7 @@
126 (erc-d-t-wait-for 10 (get-buffer "foonet")) 126 (erc-d-t-wait-for 10 (get-buffer "foonet"))
127 127
128 (ert-info ("Channel buffer #foo playback received") 128 (ert-info ("Channel buffer #foo playback received")
129 (with-current-buffer (erc-d-t-wait-for 3 (get-buffer "#foo")) 129 (with-current-buffer (erc-d-t-wait-for 10 (get-buffer "#foo"))
130 (funcall expect 10 "Excellent workman"))) 130 (funcall expect 10 "Excellent workman")))
131 131
132 (ert-info ("Global notices routed to server buffer") 132 (ert-info ("Global notices routed to server buffer")
diff --git a/test/lisp/erc/erc-stamp-tests.el b/test/lisp/erc/erc-stamp-tests.el
index ef292ccb618..a49173ffa2f 100644
--- a/test/lisp/erc/erc-stamp-tests.el
+++ b/test/lisp/erc/erc-stamp-tests.el
@@ -20,14 +20,14 @@
20;;; Commentary: 20;;; Commentary:
21 21
22;;; Code: 22;;; Code:
23(require 'erc-stamp)
24(require 'erc-goodies) ; for `erc-make-read-only'
25
23(require 'ert-x) 26(require 'ert-x)
24(eval-and-compile 27(eval-and-compile
25 (let ((load-path (cons (ert-resource-directory) load-path))) 28 (let ((load-path (cons (ert-resource-directory) load-path)))
26 (require 'erc-tests-common))) 29 (require 'erc-tests-common)))
27 30
28(require 'erc-stamp)
29(require 'erc-goodies) ; for `erc-make-read-only'
30
31;; These display-oriented tests are brittle because many factors 31;; These display-oriented tests are brittle because many factors
32;; influence how text properties are applied. We should just 32;; influence how text properties are applied. We should just
33;; rework these into full scenarios. 33;; rework these into full scenarios.
@@ -46,7 +46,7 @@
46 46
47 (with-current-buffer (get-buffer-create "*erc-stamp-tests--insert-right*") 47 (with-current-buffer (get-buffer-create "*erc-stamp-tests--insert-right*")
48 (erc-mode) 48 (erc-mode)
49 (erc-munge-invisibility-spec) 49 (erc-stamp--manage-local-options-state)
50 (erc--initialize-markers (point) nil) 50 (erc--initialize-markers (point) nil)
51 (erc-tests-common-init-server-proc "sleep" "1") 51 (erc-tests-common-init-server-proc "sleep" "1")
52 52
@@ -235,7 +235,7 @@
235 (with-current-buffer (get-buffer-create "*erc-timestamp-intangible*") 235 (with-current-buffer (get-buffer-create "*erc-timestamp-intangible*")
236 (erc-mode) 236 (erc-mode)
237 (erc--initialize-markers (point) nil) 237 (erc--initialize-markers (point) nil)
238 (erc-munge-invisibility-spec) 238 (erc-stamp--manage-local-options-state)
239 (erc-display-message nil 'notice (current-buffer) "Welcome") 239 (erc-display-message nil 'notice (current-buffer) "Welcome")
240 ;; 240 ;;
241 ;; Pretend `fill' is active and that these lines are 241 ;; Pretend `fill' is active and that these lines are
diff --git a/test/lisp/erc/erc-tests.el b/test/lisp/erc/erc-tests.el
index b51bd67ae04..085b063bdb2 100644
--- a/test/lisp/erc/erc-tests.el
+++ b/test/lisp/erc/erc-tests.el
@@ -20,13 +20,13 @@
20;; along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. 20;; along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
21 21
22;;; Code: 22;;; Code:
23(require 'erc-ring)
23 24
24(require 'ert-x) 25(require 'ert-x)
25(eval-and-compile 26(eval-and-compile
26 (let ((load-path (cons (ert-resource-directory) load-path))) 27 (let ((load-path (cons (ert-resource-directory) load-path)))
27 (require 'erc-tests-common))) 28 (require 'erc-tests-common)))
28 29
29(require 'erc-ring)
30 30
31(ert-deftest erc--read-time-period () 31(ert-deftest erc--read-time-period ()
32 (cl-letf (((symbol-function 'read-string) (lambda (&rest _) ""))) 32 (cl-letf (((symbol-function 'read-string) (lambda (&rest _) "")))
@@ -302,6 +302,7 @@
302 (cl-incf counter)))) 302 (cl-incf counter))))
303 erc-accidental-paste-threshold-seconds 303 erc-accidental-paste-threshold-seconds
304 erc-insert-modify-hook 304 erc-insert-modify-hook
305 (erc-last-input-time 0)
305 (erc-modules (remq 'stamp erc-modules)) 306 (erc-modules (remq 'stamp erc-modules))
306 (erc-send-input-line-function #'ignore) 307 (erc-send-input-line-function #'ignore)
307 (erc--input-review-functions erc--input-review-functions) 308 (erc--input-review-functions erc--input-review-functions)
@@ -1053,7 +1054,8 @@
1053 1054
1054(ert-deftest erc--get-isupport-entry () 1055(ert-deftest erc--get-isupport-entry ()
1055 (let ((erc--isupport-params (make-hash-table)) 1056 (let ((erc--isupport-params (make-hash-table))
1056 (erc-server-parameters '(("FOO" . "1") ("BAR") ("BAZ" . "A,B,C"))) 1057 (erc-server-parameters '(("FOO" . "1") ("BAR") ("BAZ" . "A,B,C")
1058 ("SPAM" . "")))
1057 (items (lambda () 1059 (items (lambda ()
1058 (cl-loop for k being the hash-keys of erc--isupport-params 1060 (cl-loop for k being the hash-keys of erc--isupport-params
1059 using (hash-values v) collect (cons k v))))) 1061 using (hash-values v) collect (cons k v)))))
@@ -1074,7 +1076,9 @@
1074 (should (equal (erc--get-isupport-entry 'FOO) '(FOO "1"))) 1076 (should (equal (erc--get-isupport-entry 'FOO) '(FOO "1")))
1075 1077
1076 (should (equal (funcall items) 1078 (should (equal (funcall items)
1077 '((BAR . --empty--) (BAZ "A" "B" "C") (FOO "1")))))) 1079 '((BAR . --empty--) (BAZ "A" "B" "C") (FOO "1"))))
1080 (should (equal (erc--get-isupport-entry 'SPAM) '(SPAM)))
1081 (should-not (erc--get-isupport-entry 'SPAM 'single))))
1078 1082
1079(ert-deftest erc-server-005 () 1083(ert-deftest erc-server-005 ()
1080 (let* ((hooked 0) 1084 (let* ((hooked 0)
@@ -1092,34 +1096,41 @@
1092 (lambda (_ _ _ line) (push line calls)))) 1096 (lambda (_ _ _ line) (push line calls))))
1093 1097
1094 (ert-info ("Baseline") 1098 (ert-info ("Baseline")
1095 (setq args '("tester" "BOT=B" "EXCEPTS" "PREFIX=(ov)@+" "are supp...") 1099 (setq args '("tester" "BOT=B" "CHANTYPES=" "EXCEPTS" "PREFIX=(ov)@+"
1100 "are supp...")
1096 parsed (make-erc-response :command-args args :command "005")) 1101 parsed (make-erc-response :command-args args :command "005"))
1097 1102
1098 (setq verify 1103 (setq verify
1099 (lambda () 1104 (lambda ()
1100 (should (equal erc-server-parameters 1105 (should (equal erc-server-parameters
1101 '(("PREFIX" . "(ov)@+") ("EXCEPTS") 1106 '(("PREFIX" . "(ov)@+") ("EXCEPTS")
1107 ;; Should be ("CHANTYPES") but
1108 ;; retained for compatibility.
1109 ("CHANTYPES" . "")
1102 ("BOT" . "B")))) 1110 ("BOT" . "B"))))
1103 (should (zerop (hash-table-count erc--isupport-params))) 1111 (should (zerop (hash-table-count erc--isupport-params)))
1104 (should (equal "(ov)@+" (erc--get-isupport-entry 'PREFIX t))) 1112 (should (equal "(ov)@+" (erc--get-isupport-entry 'PREFIX t)))
1105 (should (equal '(EXCEPTS) (erc--get-isupport-entry 'EXCEPTS))) 1113 (should (equal '(EXCEPTS) (erc--get-isupport-entry 'EXCEPTS)))
1106 (should (equal "B" (erc--get-isupport-entry 'BOT t))) 1114 (should (equal "B" (erc--get-isupport-entry 'BOT t)))
1107 (should (string= (pop calls) 1115 (should (string=
1108 "BOT=B EXCEPTS PREFIX=(ov)@+ are supp...")) 1116 (pop calls)
1117 "BOT=B CHANTYPES= EXCEPTS PREFIX=(ov)@+ are supp..."))
1109 (should (equal args (erc-response.command-args parsed))))) 1118 (should (equal args (erc-response.command-args parsed)))))
1110 1119
1111 (erc-call-hooks nil parsed)) 1120 (erc-call-hooks nil parsed))
1112 1121
1113 (ert-info ("Negated, updated") 1122 (ert-info ("Negated, updated")
1114 (setq args '("tester" "-EXCEPTS" "-FAKE" "PREFIX=(ohv)@%+" "are su...") 1123 (setq args '("tester" "-EXCEPTS" "-CHANTYPES" "-FAKE" "PREFIX=(ohv)@%+"
1124 "are su...")
1115 parsed (make-erc-response :command-args args :command "005")) 1125 parsed (make-erc-response :command-args args :command "005"))
1116 1126
1117 (setq verify 1127 (setq verify
1118 (lambda () 1128 (lambda ()
1119 (should (equal erc-server-parameters 1129 (should (equal erc-server-parameters
1120 '(("PREFIX" . "(ohv)@%+") ("BOT" . "B")))) 1130 '(("PREFIX" . "(ohv)@%+") ("BOT" . "B"))))
1121 (should (string= (pop calls) 1131 (should (string-prefix-p
1122 "-EXCEPTS -FAKE PREFIX=(ohv)@%+ are su...")) 1132 "-EXCEPTS -CHANTYPES -FAKE PREFIX=(ohv)@%+ "
1133 (pop calls)))
1123 (should (equal "(ohv)@%+" (erc--get-isupport-entry 'PREFIX t))) 1134 (should (equal "(ohv)@%+" (erc--get-isupport-entry 'PREFIX t)))
1124 (should (equal "B" (erc--get-isupport-entry 'BOT t))) 1135 (should (equal "B" (erc--get-isupport-entry 'BOT t)))
1125 (should-not (erc--get-isupport-entry 'EXCEPTS)) 1136 (should-not (erc--get-isupport-entry 'EXCEPTS))
@@ -1156,25 +1167,37 @@
1156 (should (equal (erc-downcase "\\O/") "|o/" ))))) 1167 (should (equal (erc-downcase "\\O/") "|o/" )))))
1157 1168
1158(ert-deftest erc-channel-p () 1169(ert-deftest erc-channel-p ()
1159 (let ((erc--isupport-params (make-hash-table)) 1170 (erc-tests-common-make-server-buf)
1160 erc-server-parameters)
1161
1162 (should (erc-channel-p "#chan"))
1163 (should (erc-channel-p "##chan"))
1164 (should (erc-channel-p "&chan"))
1165 (should (erc-channel-p "+chan"))
1166 (should (erc-channel-p "!chan"))
1167 (should-not (erc-channel-p "@chan"))
1168
1169 (push '("CHANTYPES" . "#&@+!") erc-server-parameters)
1170 1171
1171 (should (erc-channel-p "!chan")) 1172 (should (erc-channel-p "#chan"))
1172 (should (erc-channel-p "#chan")) 1173 (should (erc-channel-p "##chan"))
1174 (should (erc-channel-p "&chan"))
1175 (should-not (erc-channel-p "+chan"))
1176 (should-not (erc-channel-p "!chan"))
1177 (should-not (erc-channel-p "@chan"))
1178
1179 ;; Server sends "CHANTYPES=#&+!"
1180 (should-not erc-server-parameters)
1181 (setq erc-server-parameters '(("CHANTYPES" . "#&+!")))
1182 (should (erc-channel-p "#chan"))
1183 (should (erc-channel-p "&chan"))
1184 (should (erc-channel-p "+chan"))
1185 (should (erc-channel-p "!chan"))
1186
1187 (with-current-buffer (erc--open-target "#chan")
1188 (should (erc-channel-p (current-buffer))))
1189 (with-current-buffer (erc--open-target "+chan")
1190 (should (erc-channel-p (current-buffer))))
1191 (should (erc-channel-p (get-buffer "#chan")))
1192 (should (erc-channel-p (get-buffer "+chan")))
1193
1194 ;; Server sends "CHANTYPES=" because it's query only.
1195 (puthash 'CHANTYPES '("CHANTYPES") erc--isupport-params)
1196 (should-not (erc-channel-p "#spam"))
1197 (should-not (erc-channel-p "&spam"))
1198 (should-not (erc-channel-p (save-excursion (erc--open-target "#spam"))))
1173 1199
1174 (with-current-buffer (get-buffer-create "#chan") 1200 (erc-tests-common-kill-buffers))
1175 (setq erc--target (erc--target-from-string "#chan")))
1176 (should (erc-channel-p (get-buffer "#chan"))))
1177 (kill-buffer "#chan"))
1178 1201
1179(ert-deftest erc--valid-local-channel-p () 1202(ert-deftest erc--valid-local-channel-p ()
1180 (ert-info ("Local channels not supported") 1203 (ert-info ("Local channels not supported")
@@ -1189,12 +1212,16 @@
1189 (should (erc--valid-local-channel-p "&local"))))) 1212 (should (erc--valid-local-channel-p "&local")))))
1190 1213
1191(ert-deftest erc--restore-initialize-priors () 1214(ert-deftest erc--restore-initialize-priors ()
1215 (unless (>= emacs-major-version 28)
1216 (ert-skip "Lisp nesting exceeds `max-lisp-eval-depth'"))
1192 (should (pcase (macroexpand-1 '(erc--restore-initialize-priors erc-my-mode 1217 (should (pcase (macroexpand-1 '(erc--restore-initialize-priors erc-my-mode
1193 foo (ignore 1 2 3) 1218 foo (ignore 1 2 3)
1194 bar #'spam 1219 bar #'spam
1195 baz nil)) 1220 baz nil))
1196 (`(let* ((,p (or erc--server-reconnecting erc--target-priors)) 1221 (`(let* ((,p (or erc--server-reconnecting erc--target-priors))
1197 (,q (and ,p (alist-get 'erc-my-mode ,p)))) 1222 (,q (and ,p (alist-get 'erc-my-mode ,p))))
1223 (unless (local-variable-if-set-p 'erc-my-mode)
1224 (error "Not a local minor mode var: %s" 'erc-my-mode))
1198 (setq foo (if ,q (alist-get 'foo ,p) (ignore 1 2 3)) 1225 (setq foo (if ,q (alist-get 'foo ,p) (ignore 1 2 3))
1199 bar (if ,q (alist-get 'bar ,p) #'spam) 1226 bar (if ,q (alist-get 'bar ,p) #'spam)
1200 baz (if ,q (alist-get 'baz ,p) nil))) 1227 baz (if ,q (alist-get 'baz ,p) nil)))
@@ -1273,7 +1300,7 @@
1273 (setq erc-server-current-nick "tester") 1300 (setq erc-server-current-nick "tester")
1274 (setq-local erc-last-input-time 0) 1301 (setq-local erc-last-input-time 0)
1275 (should-not (local-variable-if-set-p 'erc-send-completed-hook)) 1302 (should-not (local-variable-if-set-p 'erc-send-completed-hook))
1276 (set (make-local-variable 'erc-send-completed-hook) nil) ; skip t (globals) 1303 (setq-local erc-send-completed-hook nil) ; skip t (globals)
1277 ;; Just in case erc-ring-mode is already on 1304 ;; Just in case erc-ring-mode is already on
1278 (setq-local erc--input-review-functions erc--input-review-functions) 1305 (setq-local erc--input-review-functions erc--input-review-functions)
1279 (add-hook 'erc--input-review-functions #'erc-add-to-input-ring) 1306 (add-hook 'erc--input-review-functions #'erc-add-to-input-ring)
diff --git a/test/lisp/erc/resources/base/upstream-reconnect/znc-severed.eld b/test/lisp/erc/resources/base/upstream-reconnect/znc-severed.eld
new file mode 100644
index 00000000000..32d05cc8a3a
--- /dev/null
+++ b/test/lisp/erc/resources/base/upstream-reconnect/znc-severed.eld
@@ -0,0 +1,87 @@
1;; -*- mode: lisp-data; -*-
2((pass 10 "PASS :changeme"))
3((nick 10 "NICK tester"))
4((user 10 "USER tester@vanilla/foonet 0 * :tester")
5 (0.00 ":irc.znc.in 001 tester :Welcome to ZNC")
6 (0.03 ":*status!znc@znc.in PRIVMSG tester :Connection Refused. Reconnecting...")
7 (0.01 ":*status!znc@znc.in PRIVMSG tester :Connection Refused. Reconnecting...")
8 (0.00 ":*status!znc@znc.in PRIVMSG tester :Connection Refused. Reconnecting...")
9 (0.01 ":*status!znc@znc.in PRIVMSG tester :Connected!")
10 (0.02 ":irc.foonet.org 001 tester :Welcome to the foonet IRC Network tester")
11 (0.01 ":irc.foonet.org 002 tester :Your host is irc.foonet.org, running version ergo-v2.11.1")
12 (0.01 ":irc.foonet.org 003 tester :This server was created Wed, 31 Jan 2024 10:58:16 UTC")
13 (0.01 ":irc.foonet.org 004 tester irc.foonet.org ergo-v2.11.1 BERTZios CEIMRUabefhiklmnoqstuv Iabefhkloqv")
14 (0.00 ":irc.foonet.org 005 tester AWAYLEN=390 BOT=B CASEMAPPING=ascii CHANLIMIT=#:100 CHANMODES=Ibe,k,fl,CEMRUimnstu CHANNELLEN=64 CHANTYPES=# CHATHISTORY=1000 ELIST=U EXCEPTS EXTBAN=,m FORWARD=f INVEX :are supported by this server")
15 (0.01 ":irc.foonet.org 005 tester KICKLEN=390 MAXLIST=beI:60 MAXTARGETS=4 MODES MONITOR=100 NETWORK=foonet NICKLEN=32 PREFIX=(qaohv)~&@%+ STATUSMSG=~&@%+ TARGMAX=NAMES:1,LIST:1,KICK:,WHOIS:1,USERHOST:10,PRIVMSG:4,TAGMSG:4,NOTICE:4,MONITOR:100 TOPICLEN=390 UTF8ONLY WHOX :are supported by this server")
16 (0.01 ":irc.foonet.org 005 tester draft/CHATHISTORY=1000 :are supported by this server")
17 (0.00 ":irc.foonet.org 251 tester :There are 0 users and 3 invisible on 1 server(s)")
18 (0.00 ":irc.foonet.org 252 tester 0 :IRC Operators online")
19 (0.00 ":irc.foonet.org 253 tester 0 :unregistered connections")
20 (0.00 ":irc.foonet.org 254 tester 1 :channels formed")
21 (0.00 ":irc.foonet.org 255 tester :I have 3 clients and 0 servers")
22 (0.00 ":irc.foonet.org 265 tester 3 3 :Current local users 3, max 3")
23 (0.00 ":irc.foonet.org 266 tester 3 3 :Current global users 3, max 3")
24 (0.00 ":irc.foonet.org 422 tester :MOTD File is missing")
25 (0.00 ":irc.foonet.org 221 tester +Zi")
26 (0.00 ":irc.foonet.org NOTICE tester :This server is in debug mode and is logging all user I/O. If you do not wish for everything you send to be readable by the server owner(s), please disconnect."))
27
28((mode 10 "MODE tester +i")
29 (0.01 ":irc.foonet.org 352 tester * ~u pfa3tpa5ig5ty.irc irc.foonet.org tester H :0 ZNC - https://znc.in")
30 (0.01 ":irc.foonet.org 315 tester tester :End of WHO list")
31
32 (0.02 ":tester!~u@pfa3tpa5ig5ty.irc JOIN #chan")
33 (0.03 ":irc.foonet.org 353 tester = #chan :bob tester @alice eve"))
34
35((mode 10 "MODE #chan")
36 (0.00 ":irc.foonet.org 366 tester #chan :End of NAMES list")
37 (0.00 ":bob!~u@euegh6mj3y8r2.irc PRIVMSG #chan :tester, welcome!")
38 (0.01 ":alice!~u@euegh6mj3y8r2.irc PRIVMSG #chan :tester, welcome!")
39 (0.01 ":bob!~u@euegh6mj3y8r2.irc PRIVMSG #chan :alice: And see how he will take it at your hands.")
40 (0.02 ":irc.foonet.org 221 tester +Zi")
41 (0.01 ":alice!~u@euegh6mj3y8r2.irc PRIVMSG #chan :bob: Fear not, my lord, your servant shall do so.")
42 (0.02 ":bob!~u@euegh6mj3y8r2.irc PRIVMSG #chan :alice: If I thrive well, I'll visit thee again.")
43 (0.01 ":irc.foonet.org 324 tester #chan +Cnt")
44 (0.03 ":irc.foonet.org 329 tester #chan 1706698713")
45 (0.05 ":alice!~u@euegh6mj3y8r2.irc PRIVMSG #chan :bob: Let it be forbid, sir; so should I be a great deal of his act.")
46 (0.04 ":bob!~u@euegh6mj3y8r2.irc PRIVMSG #chan :alice: And see a fearful sight of blood and death.")
47 (0.00 ":eve!~u@euegh6mj3y8r2.irc PRIVMSG #chan :hola")
48 (0.01 ":eve!~u@euegh6mj3y8r2.irc NICK :Evel")
49 (0.01 ":Evel!~u@euegh6mj3y8r2.irc PRIVMSG #chan :hell o")
50 (0.02 ":alice!~u@euegh6mj3y8r2.irc PRIVMSG #chan :bob: His highness comes post from Marseilles, of as able body as when he numbered thirty: he will be here to-morrow, or I am deceived by him that in such intelligence hath seldom failed.")
51 (0.03 ":bob!~u@euegh6mj3y8r2.irc PRIVMSG #chan :alice: See, by good hap, yonder's my lord; I have sweat to see his honour.")
52 (0.02 ":alice!~u@euegh6mj3y8r2.irc PRIVMSG #chan :bob: With the rich worth of your virginity.")
53
54 (0.02 ":*status!znc@znc.in PRIVMSG tester :Disconnected from IRC. Reconnecting...")
55 (0.05 ":*status!znc@znc.in PRIVMSG tester :Connection Refused. Reconnecting...")
56 (0.03 ":*status!znc@znc.in PRIVMSG tester :Connected!")
57 (0.01 ":irc.foonet.org 001 tester :Welcome to the foonet IRC Network tester")
58 (0.04 ":irc.foonet.org 002 tester :Your host is irc.foonet.org, running version ergo-v2.11.1")
59 (0.01 ":irc.foonet.org 003 tester :This server was created Wed, 31 Jan 2024 10:58:16 UTC")
60 (0.01 ":irc.foonet.org 004 tester irc.foonet.org ergo-v2.11.1 BERTZios CEIMRUabefhiklmnoqstuv Iabefhkloqv")
61 (0.03 ":irc.foonet.org 005 tester AWAYLEN=390 BOT=B CASEMAPPING=ascii CHANLIMIT=#:100 CHANMODES=Ibe,k,fl,CEMRUimnstu CHANNELLEN=64 CHANTYPES=# CHATHISTORY=1000 ELIST=U EXCEPTS EXTBAN=,m FORWARD=f INVEX :are supported by this server")
62 (0.01 ":irc.foonet.org 005 tester KICKLEN=390 MAXLIST=beI:60 MAXTARGETS=4 MODES MONITOR=100 NETWORK=foonet NICKLEN=32 PREFIX=(qaohv)~&@%+ STATUSMSG=~&@%+ TARGMAX=NAMES:1,LIST:1,KICK:,WHOIS:1,USERHOST:10,PRIVMSG:4,TAGMSG:4,NOTICE:4,MONITOR:100 TOPICLEN=390 UTF8ONLY WHOX :are supported by this server")
63 (0.01 ":irc.foonet.org 005 tester draft/CHATHISTORY=1000 :are supported by this server")
64 (0.00 ":irc.foonet.org 251 tester :There are 0 users and 3 invisible on 1 server(s)")
65 (0.00 ":irc.foonet.org 252 tester 0 :IRC Operators online")
66 (0.00 ":irc.foonet.org 253 tester 0 :unregistered connections")
67 (0.00 ":irc.foonet.org 254 tester 1 :channels formed")
68 (0.00 ":irc.foonet.org 255 tester :I have 3 clients and 0 servers")
69 (0.00 ":irc.foonet.org 265 tester 3 3 :Current local users 3, max 3")
70 (0.00 ":irc.foonet.org 266 tester 3 3 :Current global users 3, max 3")
71 (0.00 ":irc.foonet.org 422 tester :MOTD File is missing")
72 (0.02 ":irc.foonet.org 221 tester +i")
73 (0.01 ":irc.foonet.org NOTICE tester :This server is in debug mode and is logging all user I/O. If you do not wish for everything you send to be readable by the server owner(s), please disconnect.")
74 (0.02 ":irc.foonet.org 352 tester * ~u hrn2ea3rpeyck.irc irc.foonet.org tester H :0 ZNC - https://znc.in")
75 (0.01 ":irc.foonet.org 315 tester tester :End of WHO list")
76 (0.02 ":tester!~u@hrn2ea3rpeyck.irc JOIN #chan"))
77
78((mode 10 "MODE #chan")
79 (0.00 ":irc.foonet.org 353 tester = #chan :tester @alice bob")
80 (0.01 ":irc.foonet.org 366 tester #chan :End of NAMES list")
81 (0.00 ":alice!~u@euegh6mj3y8r2.irc PRIVMSG #chan :tester, welcome!")
82 (0.01 ":bob!~u@euegh6mj3y8r2.irc PRIVMSG #chan :tester, welcome!")
83 (0.02 ":alice!~u@euegh6mj3y8r2.irc PRIVMSG #chan :bob: Nay, I assure you, a peace concluded.")
84 (0.03 ":irc.foonet.org 324 tester #chan +Cnt")
85 (0.01 ":irc.foonet.org 329 tester #chan 1706698713")
86 (0.05 ":bob!~u@euegh6mj3y8r2.irc PRIVMSG #chan :alice: But, in defence, by mercy, 'tis most just.")
87 (0.04 ":alice!~u@euegh6mj3y8r2.irc PRIVMSG #chan :bob: Or to drown my clothes, and say I was stripped."))
diff --git a/test/lisp/erc/resources/commands/amsg-barnet.eld b/test/lisp/erc/resources/commands/amsg-barnet.eld
new file mode 100644
index 00000000000..53b3e18651a
--- /dev/null
+++ b/test/lisp/erc/resources/commands/amsg-barnet.eld
@@ -0,0 +1,54 @@
1;; -*- mode: lisp-data; -*-
2((nick 10 "NICK tester"))
3((user 10 "USER user 0 * :unknown")
4 (0 ":irc.barnet.org 001 tester :Welcome to the barnet IRC Network tester")
5 (0 ":irc.barnet.org 002 tester :Your host is irc.barnet.org, running version oragono-2.6.0-7481bf0385b95b16")
6 (0 ":irc.barnet.org 003 tester :This server was created Tue, 04 May 2021 05:06:19 UTC")
7 (0 ":irc.barnet.org 004 tester irc.barnet.org oragono-2.6.0-7481bf0385b95b16 BERTZios CEIMRUabefhiklmnoqstuv Iabefhkloqv")
8 (0 ":irc.barnet.org 005 tester AWAYLEN=390 BOT=B CASEMAPPING=ascii CHANLIMIT=#:100 CHANMODES=Ibe,k,fl,CEMRUimnstu CHANNELLEN=64 CHANTYPES=# ELIST=U EXCEPTS EXTBAN=,m FORWARD=f INVEX KICKLEN=390 :are supported by this server")
9 (0 ":irc.barnet.org 005 tester MAXLIST=beI:60 MAXTARGETS=4 MODES MONITOR=100 NETWORK=barnet NICKLEN=32 PREFIX=(qaohv)~&@%+ STATUSMSG=~&@%+ TARGMAX=NAMES:1,LIST:1,KICK:1,WHOIS:1,USERHOST:10,PRIVMSG:4,TAGMSG:4,NOTICE:4,MONITOR:100 TOPICLEN=390 UTF8MAPPING=rfc8265 UTF8ONLY WHOX :are supported by this server")
10 (0 ":irc.barnet.org 005 tester draft/CHATHISTORY=100 :are supported by this server")
11 (0 ":irc.barnet.org 251 tester :There are 0 users and 3 invisible on 1 server(s)")
12 (0 ":irc.barnet.org 252 tester 0 :IRC Operators online")
13 (0 ":irc.barnet.org 253 tester 0 :unregistered connections")
14 (0 ":irc.barnet.org 254 tester 1 :channels formed")
15 (0 ":irc.barnet.org 255 tester :I have 3 clients and 0 servers")
16 (0 ":irc.barnet.org 265 tester 3 3 :Current local users 3, max 3")
17 (0 ":irc.barnet.org 266 tester 3 3 :Current global users 3, max 3")
18 (0 ":irc.barnet.org 422 tester :MOTD File is missing"))
19
20((mode-user 10 "MODE tester +i")
21 (0 ":irc.barnet.org 221 tester +i")
22 (0 ":irc.barnet.org NOTICE tester :This server is in debug mode and is logging all user I/O. If you do not wish for everything you send to be readable by the server owner(s), please disconnect."))
23
24((join 10 "JOIN #bar")
25 (0 ":tester!~u@jnu48g2wrycbw.irc JOIN #bar")
26 (0 ":irc.barnet.org 353 tester = #bar :@mike joe tester")
27 (0 ":irc.barnet.org 366 tester #bar :End of NAMES list"))
28
29((mode-bar 10 "MODE #bar")
30 (0 ":irc.barnet.org 324 tester #bar +nt")
31 (0 ":irc.barnet.org 329 tester #bar 1620104779")
32 (0.1 ":mike!~u@kd7gmjbnbkn8c.irc PRIVMSG #bar :tester, welcome!")
33 (0.1 ":joe!~u@kd7gmjbnbkn8c.irc PRIVMSG #bar :tester, welcome!")
34 (0.1 ":mike!~u@kd7gmjbnbkn8c.irc PRIVMSG #bar :joe: Whipp'd first, sir, and hang'd after.")
35 (0.1 ":joe!~u@kd7gmjbnbkn8c.irc PRIVMSG #bar :mike: We have yet many among us can gripe as hard as Cassibelan; I do not say I am one, but I have a hand. Why tribute ? why should we pay tribute ? If C sar can hide the sun from us with a blanket, or put the moon in his pocket, we will pay him tribute for light; else, sir, no more tribute, pray you now."))
36
37((privmsg-2 10 "PRIVMSG #bar :2 barnet only")
38 (0.1 ":mike!~u@kd7gmjbnbkn8c.irc PRIVMSG #bar :joe: Double and treble admonition, and still forfeit in the same kind ? This would make mercy swear, and play the tyrant.")
39 (0.1 ":joe!~u@kd7gmjbnbkn8c.irc PRIVMSG #bar :mike: And secretly to greet the empress' friends."))
40
41((privmsg-4 10 "PRIVMSG #bar :\1ACTION 4 barnet only\1")
42 (0.1 ":mike!~u@kd7gmjbnbkn8c.irc PRIVMSG #bar :joe: You have not been inquired after: I have sat here all day.")
43 (0.1 ":joe!~u@kd7gmjbnbkn8c.irc PRIVMSG #bar :mike: That same Berowne I'll torture ere I go."))
44
45((privmsg-5 10 "PRIVMSG #bar :5 all nets"))
46
47((privmsg-6 10 "PRIVMSG #bar :\1ACTION 6 all nets\1")
48 (0.1 ":mike!~u@kd7gmjbnbkn8c.irc PRIVMSG #bar :joe: For mine own part,no offence to the general, nor any man of quality,I hope to be saved.")
49 (0.1 ":joe!~u@kd7gmjbnbkn8c.irc PRIVMSG #bar :mike: Mehercle! if their sons be ingenuous, they shall want no instruction; if their daughters be capable, I will put it to them. But, vir sapit qui pauca loquitur. A soul feminine saluteth us."))
50
51((quit 5 "QUIT :\2ERC\2")
52 (0 ":tester!~u@jnu48g2wrycbw.irc QUIT :Quit"))
53
54((drop 0 DROP))
diff --git a/test/lisp/erc/resources/commands/amsg-foonet.eld b/test/lisp/erc/resources/commands/amsg-foonet.eld
new file mode 100644
index 00000000000..eb3d84d646a
--- /dev/null
+++ b/test/lisp/erc/resources/commands/amsg-foonet.eld
@@ -0,0 +1,56 @@
1;; -*- mode: lisp-data; -*-
2((nick 10 "NICK tester"))
3((user 10 "USER user 0 * :unknown")
4 (0 ":irc.foonet.org 001 tester :Welcome to the foonet IRC Network tester")
5 (0 ":irc.foonet.org 002 tester :Your host is irc.foonet.org, running version oragono-2.6.0-7481bf0385b95b16")
6 (0 ":irc.foonet.org 003 tester :This server was created Tue, 04 May 2021 05:06:18 UTC")
7 (0 ":irc.foonet.org 004 tester irc.foonet.org oragono-2.6.0-7481bf0385b95b16 BERTZios CEIMRUabefhiklmnoqstuv Iabefhkloqv")
8 (0 ":irc.foonet.org 005 tester AWAYLEN=390 BOT=B CASEMAPPING=ascii CHANLIMIT=#:100 CHANMODES=Ibe,k,fl,CEMRUimnstu CHANNELLEN=64 CHANTYPES=# ELIST=U EXCEPTS EXTBAN=,m FORWARD=f INVEX KICKLEN=390 :are supported by this server")
9 (0 ":irc.foonet.org 005 tester MAXLIST=beI:60 MAXTARGETS=4 MODES MONITOR=100 NETWORK=foonet NICKLEN=32 PREFIX=(qaohv)~&@%+ STATUSMSG=~&@%+ TARGMAX=NAMES:1,LIST:1,KICK:1,WHOIS:1,USERHOST:10,PRIVMSG:4,TAGMSG:4,NOTICE:4,MONITOR:100 TOPICLEN=390 UTF8MAPPING=rfc8265 UTF8ONLY WHOX :are supported by this server")
10 (0 ":irc.foonet.org 005 tester draft/CHATHISTORY=100 :are supported by this server")
11 (0 ":irc.foonet.org 251 tester :There are 0 users and 3 invisible on 1 server(s)")
12 (0 ":irc.foonet.org 252 tester 0 :IRC Operators online")
13 (0 ":irc.foonet.org 253 tester 0 :unregistered connections")
14 (0 ":irc.foonet.org 254 tester 1 :channels formed")
15 (0 ":irc.foonet.org 255 tester :I have 3 clients and 0 servers")
16 (0 ":irc.foonet.org 265 tester 3 3 :Current local users 3, max 3")
17 (0 ":irc.foonet.org 266 tester 3 3 :Current global users 3, max 3")
18 (0 ":irc.foonet.org 422 tester :MOTD File is missing"))
19
20((mode-user 10 "MODE tester +i")
21 (0 ":irc.foonet.org 221 tester +i")
22 (0 ":irc.foonet.org NOTICE tester :This server is in debug mode and is logging all user I/O. If you do not wish for everything you send to be readable by the server owner(s), please disconnect."))
23
24((join 10 "JOIN #foo")
25 (0 ":tester!~u@9g6b728983yd2.irc JOIN #foo")
26 (0 ":irc.foonet.org 353 tester = #foo :alice tester @bob")
27 (0 ":irc.foonet.org 366 tester #foo :End of NAMES list"))
28
29((mode-foo 10 "MODE #foo")
30 (0 ":irc.foonet.org 324 tester #foo +nt")
31 (0 ":irc.foonet.org 329 tester #foo 1620104779")
32 (0.1 ":bob!~u@rz2v467q4rwhy.irc PRIVMSG #foo :tester, welcome!")
33 (0.1 ":alice!~u@rz2v467q4rwhy.irc PRIVMSG #foo :tester, welcome!")
34 (0.1 ":bob!~u@rz2v467q4rwhy.irc PRIVMSG #foo :alice: But, as it seems, did violence on herself.")
35 (0.1 ":alice!~u@rz2v467q4rwhy.irc PRIVMSG #foo :bob: Well, this is the forest of Arden."))
36
37((privmsg-1 10 "PRIVMSG #foo :1 foonet only")
38 (0.1 ":bob!~u@rz2v467q4rwhy.irc PRIVMSG #foo :alice: Signior Iachimo will not from it. Pray, let us follow 'em.")
39 (0.1 ":alice!~u@rz2v467q4rwhy.irc PRIVMSG #foo :bob: Our queen and all her elves come here anon."))
40
41((privmsg-3 10 "PRIVMSG #foo :\1ACTION 3 foonet only\1")
42 (0.1 ":bob!~u@rz2v467q4rwhy.irc PRIVMSG #foo :alice: The ground is bloody; search about the churchyard.")
43 (0.1 ":alice!~u@rz2v467q4rwhy.irc PRIVMSG #foo :bob: You have discharged this honestly: keep it to yourself. Many likelihoods informed me of this before, which hung so tottering in the balance that I could neither believe nor misdoubt. Pray you, leave me: stall this in your bosom; and I thank you for your honest care. I will speak with you further anon."))
44
45((privmsg-5 10 "PRIVMSG #foo :5 all nets"))
46
47((privmsg-6 10 "PRIVMSG #foo :\1ACTION 6 all nets\1")
48 (0.1 ":bob!~u@rz2v467q4rwhy.irc PRIVMSG #foo :alice: Give me that mattock, and the wrenching iron.")
49 (0.1 ":alice!~u@rz2v467q4rwhy.irc PRIVMSG #foo :bob: Stand you! You have land enough of your own; but he added to your having, gave you some ground."))
50
51((privmsg-6 10 "PRIVMSG #foo :7 all live nets")
52 (0.1 ":bob!~u@rz2v467q4rwhy.irc PRIVMSG #foo :alice: Excellent workman! Thou canst not paint a man so bad as is thyself."))
53
54((privmsg-6 10 "PRIVMSG #foo :\1ACTION 8 all live nets\1")
55 (0.1 ":alice!~u@rz2v467q4rwhy.irc PRIVMSG #foo :bob: And will you, being a man of your breeding, be married under a bush, like a beggar ? Get you to church, and have a good priest that can tell you what marriage is: this fellow will but join you together as they join wainscot; then one of you will prove a shrunk panel, and like green timber, warp, warp.")
56 (0.1 ":bob!~u@rz2v467q4rwhy.irc PRIVMSG #foo :alice: Live, and be prosperous; and farewell, good fellow."))
diff --git a/test/lisp/erc/resources/erc-scenarios-common.el b/test/lisp/erc/resources/erc-scenarios-common.el
index 0ec48d766ef..9ad5ce49429 100644
--- a/test/lisp/erc/resources/erc-scenarios-common.el
+++ b/test/lisp/erc/resources/erc-scenarios-common.el
@@ -94,7 +94,8 @@
94(require 'erc) 94(require 'erc)
95 95
96(eval-when-compile (require 'erc-join) 96(eval-when-compile (require 'erc-join)
97 (require 'erc-services)) 97 (require 'erc-services)
98 (require 'erc-fill))
98 99
99(declare-function erc-network "erc-networks") 100(declare-function erc-network "erc-networks")
100(defvar erc-network) 101(defvar erc-network)
@@ -148,9 +149,11 @@
148 (timer-list (copy-sequence timer-list)) 149 (timer-list (copy-sequence timer-list))
149 (timer-idle-list (copy-sequence timer-idle-list)) 150 (timer-idle-list (copy-sequence timer-idle-list))
150 (erc-auth-source-parameters-join-function nil) 151 (erc-auth-source-parameters-join-function nil)
152 (erc--fill-wrap-scrolltobottom-exempt-p t)
151 (erc-autojoin-channels-alist nil) 153 (erc-autojoin-channels-alist nil)
152 (erc-server-auto-reconnect nil) 154 (erc-server-auto-reconnect nil)
153 (erc-after-connect nil) 155 (erc-after-connect nil)
156 (erc-last-input-time 0)
154 (erc-d-linger-secs 10) 157 (erc-d-linger-secs 10)
155 ,@bindings))) 158 ,@bindings)))
156 159
diff --git a/test/lisp/erc/resources/erc-tests-common.el b/test/lisp/erc/resources/erc-tests-common.el
index 05dbe1d50d6..99f15b89b03 100644
--- a/test/lisp/erc/resources/erc-tests-common.el
+++ b/test/lisp/erc/resources/erc-tests-common.el
@@ -122,7 +122,7 @@ Use NAME for the network and the session server as well."
122 erc--isupport-params (make-hash-table) 122 erc--isupport-params (make-hash-table)
123 erc-session-port 6667 123 erc-session-port 6667
124 erc-network (intern name) 124 erc-network (intern name)
125 erc-networks--id (erc-networks--id-create nil)) 125 erc-networks--id (erc-networks--id-create name))
126 (current-buffer))) 126 (current-buffer)))
127 127
128(defun erc-tests-common-string-to-propertized-parts (string) 128(defun erc-tests-common-string-to-propertized-parts (string)
diff --git a/test/lisp/eshell/esh-opt-tests.el b/test/lisp/eshell/esh-opt-tests.el
index 8d6e0c1e426..4e5373e53cd 100644
--- a/test/lisp/eshell/esh-opt-tests.el
+++ b/test/lisp/eshell/esh-opt-tests.el
@@ -29,13 +29,15 @@
29 (eshell--process-args 29 (eshell--process-args
30 "sudo" '("-a") 30 "sudo" '("-a")
31 '((?a "all" nil show-all 31 '((?a "all" nil show-all
32 "do not ignore entries starting with ."))))) 32 "do not ignore entries starting with ."))
33 '(show-all))))
33 (should 34 (should
34 (equal '("root" "world") 35 (equal '("root" "world")
35 (eshell--process-args 36 (eshell--process-args
36 "sudo" '("-u" "root" "world") 37 "sudo" '("-u" "root" "world")
37 '((?u "user" t user 38 '((?u "user" t user
38 "execute a command as another USER")))))) 39 "execute a command as another USER"))
40 '(user)))))
39 41
40(ert-deftest esh-opt-test/process-args-parse-leading-options-only () 42(ert-deftest esh-opt-test/process-args-parse-leading-options-only ()
41 "Test behavior of :parse-leading-options-only in `eshell--process-args'." 43 "Test behavior of :parse-leading-options-only in `eshell--process-args'."
@@ -45,20 +47,23 @@
45 "sudo" '("emerge" "-uDN" "world") 47 "sudo" '("emerge" "-uDN" "world")
46 '((?u "user" t user 48 '((?u "user" t user
47 "execute a command as another USER") 49 "execute a command as another USER")
48 :parse-leading-options-only)))) 50 :parse-leading-options-only)
51 '(user))))
49 (should 52 (should
50 (equal '("root" "emerge" "-uDN" "world") 53 (equal '("root" "emerge" "-uDN" "world")
51 (eshell--process-args 54 (eshell--process-args
52 "sudo" '("-u" "root" "emerge" "-uDN" "world") 55 "sudo" '("-u" "root" "emerge" "-uDN" "world")
53 '((?u "user" t user 56 '((?u "user" t user
54 "execute a command as another USER") 57 "execute a command as another USER")
55 :parse-leading-options-only)))) 58 :parse-leading-options-only)
59 '(user))))
56 (should 60 (should
57 (equal '("DN" "emerge" "world") 61 (equal '("DN" "emerge" "world")
58 (eshell--process-args 62 (eshell--process-args
59 "sudo" '("-u" "root" "emerge" "-uDN" "world") 63 "sudo" '("-u" "root" "emerge" "-uDN" "world")
60 '((?u "user" t user 64 '((?u "user" t user
61 "execute a command as another USER")))))) 65 "execute a command as another USER"))
66 '(user)))))
62 67
63(ert-deftest esh-opt-test/process-args-external () 68(ert-deftest esh-opt-test/process-args-external ()
64 "Test behavior of :external in `eshell--process-args'." 69 "Test behavior of :external in `eshell--process-args'."
@@ -69,7 +74,8 @@
69 "ls" '("/some/path") 74 "ls" '("/some/path")
70 '((?a "all" nil show-all 75 '((?a "all" nil show-all
71 "do not ignore entries starting with .") 76 "do not ignore entries starting with .")
72 :external "ls"))))) 77 :external "ls")
78 '(show-all)))))
73 (cl-letf (((symbol-function 'eshell-search-path) #'identity)) 79 (cl-letf (((symbol-function 'eshell-search-path) #'identity))
74 (should 80 (should
75 (equal '(no-catch eshell-ext-command "ls") 81 (equal '(no-catch eshell-ext-command "ls")
@@ -78,7 +84,8 @@
78 "ls" '("-u" "/some/path") 84 "ls" '("-u" "/some/path")
79 '((?a "all" nil show-all 85 '((?a "all" nil show-all
80 "do not ignore entries starting with .") 86 "do not ignore entries starting with .")
81 :external "ls")) 87 :external "ls")
88 '(show-all))
82 :type 'no-catch)))) 89 :type 'no-catch))))
83 (cl-letf (((symbol-function 'eshell-search-path) #'ignore)) 90 (cl-letf (((symbol-function 'eshell-search-path) #'ignore))
84 (should-error 91 (should-error
@@ -86,7 +93,8 @@
86 "ls" '("-u" "/some/path") 93 "ls" '("-u" "/some/path")
87 '((?a "all" nil show-all 94 '((?a "all" nil show-all
88 "do not ignore entries starting with .") 95 "do not ignore entries starting with .")
89 :external "ls")) 96 :external "ls")
97 '(show-all))
90 :type 'error))) 98 :type 'error)))
91 99
92(ert-deftest esh-opt-test/eval-using-options-short () 100(ert-deftest esh-opt-test/eval-using-options-short ()
diff --git a/test/lisp/eshell/eshell-tests.el b/test/lisp/eshell/eshell-tests.el
index e01e033e25e..e58b5a14ed9 100644
--- a/test/lisp/eshell/eshell-tests.el
+++ b/test/lisp/eshell/eshell-tests.el
@@ -153,7 +153,7 @@ insert the queued one at the next prompt, and finally run it."
153 "Test flushing of previous output" 153 "Test flushing of previous output"
154 (with-temp-eshell 154 (with-temp-eshell
155 (eshell-insert-command "echo alpha") 155 (eshell-insert-command "echo alpha")
156 (eshell-kill-output) 156 (eshell-delete-output)
157 (should (eshell-match-output 157 (should (eshell-match-output
158 (concat "^" (regexp-quote "*** output flushed ***\n") "$"))))) 158 (concat "^" (regexp-quote "*** output flushed ***\n") "$")))))
159 159
diff --git a/test/lisp/filenotify-tests.el b/test/lisp/filenotify-tests.el
index 11af1f75574..28f4d5fa181 100644
--- a/test/lisp/filenotify-tests.el
+++ b/test/lisp/filenotify-tests.el
@@ -74,8 +74,8 @@
74(defvar file-notify--test-events nil) 74(defvar file-notify--test-events nil)
75(defvar file-notify--test-monitors nil) 75(defvar file-notify--test-monitors nil)
76 76
77(defun file-notify--test-read-event () 77(defun file-notify--test-wait-event ()
78 "Read one event. 78 "Wait for one event.
79There are different timeouts for local and remote file notification libraries." 79There are different timeouts for local and remote file notification libraries."
80 (read-event 80 (read-event
81 nil nil 81 nil nil
@@ -87,7 +87,8 @@ There are different timeouts for local and remote file notification libraries."
87 ;; for any monitor. 87 ;; for any monitor.
88 ((file-notify--test-monitor) 7) 88 ((file-notify--test-monitor) 7)
89 ((file-remote-p temporary-file-directory) 0.1) 89 ((file-remote-p temporary-file-directory) 0.1)
90 (t 0.01)))) 90 (t 0.01)))
91 nil)
91 92
92(defun file-notify--test-timeout () 93(defun file-notify--test-timeout ()
93 "Timeout to wait for arriving a bunch of events, in seconds." 94 "Timeout to wait for arriving a bunch of events, in seconds."
@@ -103,7 +104,7 @@ There are different timeouts for local and remote file notification libraries."
103TIMEOUT is the maximum time to wait for, in seconds." 104TIMEOUT is the maximum time to wait for, in seconds."
104 `(with-timeout (,timeout (ignore)) 105 `(with-timeout (,timeout (ignore))
105 (while (null ,until) 106 (while (null ,until)
106 (file-notify--test-read-event)))) 107 (file-notify--test-wait-event))))
107 108
108(defun file-notify--test-no-descriptors () 109(defun file-notify--test-no-descriptors ()
109 "Check that `file-notify-descriptors' is an empty hash table. 110 "Check that `file-notify-descriptors' is an empty hash table.
@@ -452,7 +453,7 @@ If UNSTABLE is non-nil, the test is tagged as `:unstable'."
452 ;; Check, that removing watch descriptors out of order do not 453 ;; Check, that removing watch descriptors out of order do not
453 ;; harm. This fails on cygwin because of timing issues unless a 454 ;; harm. This fails on cygwin because of timing issues unless a
454 ;; long `sit-for' is added before the call to 455 ;; long `sit-for' is added before the call to
455 ;; `file-notify--test-read-event'. 456 ;; `file-notify--test-wait-event'.
456 (unless (eq system-type 'cygwin) 457 (unless (eq system-type 'cygwin)
457 (let (results) 458 (let (results)
458 (cl-flet ((first-callback (event) 459 (cl-flet ((first-callback (event)
@@ -480,7 +481,7 @@ If UNSTABLE is non-nil, the test is tagged as `:unstable'."
480 ;; Remove first watch. 481 ;; Remove first watch.
481 (file-notify-rm-watch file-notify--test-desc) 482 (file-notify-rm-watch file-notify--test-desc)
482 ;; Only the second callback shall run. 483 ;; Only the second callback shall run.
483 (file-notify--test-read-event) 484 (file-notify--test-wait-event)
484 (delete-file file-notify--test-tmpfile) 485 (delete-file file-notify--test-tmpfile)
485 (file-notify--test-wait-for-events 486 (file-notify--test-wait-for-events
486 (file-notify--test-timeout) results) 487 (file-notify--test-timeout) results)
@@ -622,7 +623,7 @@ delivered."
622 (cons 'file-notify while-no-input-ignore-events)) 623 (cons 'file-notify while-no-input-ignore-events))
623 create-lockfiles) 624 create-lockfiles)
624 ;; Flush pending actions. 625 ;; Flush pending actions.
625 (file-notify--test-read-event) 626 (file-notify--test-wait-event)
626 (file-notify--test-wait-for-events 627 (file-notify--test-wait-for-events
627 (file-notify--test-timeout) 628 (file-notify--test-timeout)
628 (not (input-pending-p))) 629 (not (input-pending-p)))
@@ -671,7 +672,7 @@ delivered."
671 (t '(created changed deleted stopped))) 672 (t '(created changed deleted stopped)))
672 (write-region 673 (write-region
673 "another text" nil file-notify--test-tmpfile nil 'no-message) 674 "another text" nil file-notify--test-tmpfile nil 'no-message)
674 (file-notify--test-read-event) 675 (file-notify--test-wait-event)
675 (delete-file file-notify--test-tmpfile)) 676 (delete-file file-notify--test-tmpfile))
676 (file-notify-rm-watch file-notify--test-desc) 677 (file-notify-rm-watch file-notify--test-desc)
677 678
@@ -707,7 +708,7 @@ delivered."
707 (changed changed deleted stopped)))) 708 (changed changed deleted stopped))))
708 (write-region 709 (write-region
709 "another text" nil file-notify--test-tmpfile nil 'no-message) 710 "another text" nil file-notify--test-tmpfile nil 'no-message)
710 (file-notify--test-read-event) 711 (file-notify--test-wait-event)
711 (delete-file file-notify--test-tmpfile)) 712 (delete-file file-notify--test-tmpfile))
712 (file-notify-rm-watch file-notify--test-desc) 713 (file-notify-rm-watch file-notify--test-desc)
713 714
@@ -755,7 +756,7 @@ delivered."
755 (t '(created changed deleted deleted stopped))) 756 (t '(created changed deleted deleted stopped)))
756 (write-region 757 (write-region
757 "any text" nil file-notify--test-tmpfile nil 'no-message) 758 "any text" nil file-notify--test-tmpfile nil 'no-message)
758 (file-notify--test-read-event) 759 (file-notify--test-wait-event)
759 (delete-directory file-notify--test-tmpdir 'recursive)) 760 (delete-directory file-notify--test-tmpdir 'recursive))
760 (file-notify-rm-watch file-notify--test-desc) 761 (file-notify-rm-watch file-notify--test-desc)
761 762
@@ -805,14 +806,14 @@ delivered."
805 deleted deleted deleted stopped))) 806 deleted deleted deleted stopped)))
806 (write-region 807 (write-region
807 "any text" nil file-notify--test-tmpfile nil 'no-message) 808 "any text" nil file-notify--test-tmpfile nil 'no-message)
808 (file-notify--test-read-event) 809 (file-notify--test-wait-event)
809 (copy-file file-notify--test-tmpfile file-notify--test-tmpfile1) 810 (copy-file file-notify--test-tmpfile file-notify--test-tmpfile1)
810 ;; The next two events shall not be visible. 811 ;; The next two events shall not be visible.
811 (file-notify--test-read-event) 812 (file-notify--test-wait-event)
812 (set-file-modes file-notify--test-tmpfile 000 'nofollow) 813 (set-file-modes file-notify--test-tmpfile 000 'nofollow)
813 (file-notify--test-read-event) 814 (file-notify--test-wait-event)
814 (set-file-times file-notify--test-tmpfile '(0 0) 'nofollow) 815 (set-file-times file-notify--test-tmpfile '(0 0) 'nofollow)
815 (file-notify--test-read-event) 816 (file-notify--test-wait-event)
816 (delete-directory file-notify--test-tmpdir 'recursive)) 817 (delete-directory file-notify--test-tmpdir 'recursive))
817 (file-notify-rm-watch file-notify--test-desc) 818 (file-notify-rm-watch file-notify--test-desc)
818 819
@@ -860,10 +861,10 @@ delivered."
860 (t '(created changed renamed deleted deleted stopped))) 861 (t '(created changed renamed deleted deleted stopped)))
861 (write-region 862 (write-region
862 "any text" nil file-notify--test-tmpfile nil 'no-message) 863 "any text" nil file-notify--test-tmpfile nil 'no-message)
863 (file-notify--test-read-event) 864 (file-notify--test-wait-event)
864 (rename-file file-notify--test-tmpfile file-notify--test-tmpfile1) 865 (rename-file file-notify--test-tmpfile file-notify--test-tmpfile1)
865 ;; After the rename, we won't get events anymore. 866 ;; After the rename, we won't get events anymore.
866 (file-notify--test-read-event) 867 (file-notify--test-wait-event)
867 (delete-directory file-notify--test-tmpdir 'recursive)) 868 (delete-directory file-notify--test-tmpdir 'recursive))
868 (file-notify-rm-watch file-notify--test-desc) 869 (file-notify-rm-watch file-notify--test-desc)
869 870
@@ -912,11 +913,11 @@ delivered."
912 (t '(attribute-changed attribute-changed))) 913 (t '(attribute-changed attribute-changed)))
913 (write-region 914 (write-region
914 "any text" nil file-notify--test-tmpfile nil 'no-message) 915 "any text" nil file-notify--test-tmpfile nil 'no-message)
915 (file-notify--test-read-event) 916 (file-notify--test-wait-event)
916 (set-file-modes file-notify--test-tmpfile 000 'nofollow) 917 (set-file-modes file-notify--test-tmpfile 000 'nofollow)
917 (file-notify--test-read-event) 918 (file-notify--test-wait-event)
918 (set-file-times file-notify--test-tmpfile '(0 0) 'nofollow) 919 (set-file-times file-notify--test-tmpfile '(0 0) 'nofollow)
919 (file-notify--test-read-event) 920 (file-notify--test-wait-event)
920 (delete-file file-notify--test-tmpfile)) 921 (delete-file file-notify--test-tmpfile))
921 (file-notify-rm-watch file-notify--test-desc) 922 (file-notify-rm-watch file-notify--test-desc)
922 923
@@ -1087,7 +1088,7 @@ delivered."
1087 (changed changed deleted stopped)))) 1088 (changed changed deleted stopped))))
1088 (write-region 1089 (write-region
1089 "another text" nil file-notify--test-tmpfile nil 'no-message) 1090 "another text" nil file-notify--test-tmpfile nil 'no-message)
1090 (file-notify--test-read-event) 1091 (file-notify--test-wait-event)
1091 (delete-file file-notify--test-tmpfile)) 1092 (delete-file file-notify--test-tmpfile))
1092 ;; After deleting the file, the descriptor is not valid anymore. 1093 ;; After deleting the file, the descriptor is not valid anymore.
1093 (should-not (file-notify-valid-p file-notify--test-desc)) 1094 (should-not (file-notify-valid-p file-notify--test-desc))
@@ -1134,7 +1135,7 @@ delivered."
1134 (t '(created changed deleted deleted stopped))) 1135 (t '(created changed deleted deleted stopped)))
1135 (write-region 1136 (write-region
1136 "any text" nil file-notify--test-tmpfile nil 'no-message) 1137 "any text" nil file-notify--test-tmpfile nil 'no-message)
1137 (file-notify--test-read-event) 1138 (file-notify--test-wait-event)
1138 (delete-directory file-notify--test-tmpdir 'recursive)) 1139 (delete-directory file-notify--test-tmpdir 'recursive))
1139 ;; After deleting the parent directory, the descriptor must 1140 ;; After deleting the parent directory, the descriptor must
1140 ;; not be valid anymore. 1141 ;; not be valid anymore.
@@ -1247,9 +1248,9 @@ delivered."
1247 (let ((source-file-list source-file-list) 1248 (let ((source-file-list source-file-list)
1248 (target-file-list target-file-list)) 1249 (target-file-list target-file-list))
1249 (while (and source-file-list target-file-list) 1250 (while (and source-file-list target-file-list)
1250 (file-notify--test-read-event) 1251 (file-notify--test-wait-event)
1251 (write-region "" nil (pop source-file-list) nil 'no-message) 1252 (write-region "" nil (pop source-file-list) nil 'no-message)
1252 (file-notify--test-read-event) 1253 (file-notify--test-wait-event)
1253 (write-region "" nil (pop target-file-list) nil 'no-message)))) 1254 (write-region "" nil (pop target-file-list) nil 'no-message))))
1254 (file-notify--test-with-actions 1255 (file-notify--test-with-actions
1255 (cond 1256 (cond
@@ -1272,11 +1273,11 @@ delivered."
1272 (let ((source-file-list source-file-list) 1273 (let ((source-file-list source-file-list)
1273 (target-file-list target-file-list)) 1274 (target-file-list target-file-list))
1274 (while (and source-file-list target-file-list) 1275 (while (and source-file-list target-file-list)
1275 (file-notify--test-read-event) 1276 (file-notify--test-wait-event)
1276 (rename-file (pop source-file-list) (pop target-file-list) t)))) 1277 (rename-file (pop source-file-list) (pop target-file-list) t))))
1277 (file-notify--test-with-actions (make-list n 'deleted) 1278 (file-notify--test-with-actions (make-list n 'deleted)
1278 (dolist (file target-file-list) 1279 (dolist (file target-file-list)
1279 (file-notify--test-read-event) 1280 (file-notify--test-wait-event)
1280 (delete-file file))) 1281 (delete-file file)))
1281 (delete-directory file-notify--test-tmpfile) 1282 (delete-directory file-notify--test-tmpfile)
1282 (if (or (string-equal (file-notify--test-library) "w32notify") 1283 (if (or (string-equal (file-notify--test-library) "w32notify")
@@ -1464,7 +1465,7 @@ the file watch."
1464 ;; does not report the `changed' event. 1465 ;; does not report the `changed' event.
1465 (make-list (/ n 2) 'created))) 1466 (make-list (/ n 2) 'created)))
1466 (dotimes (i n) 1467 (dotimes (i n)
1467 (file-notify--test-read-event) 1468 (file-notify--test-wait-event)
1468 (if (zerop (mod i 2)) 1469 (if (zerop (mod i 2))
1469 (write-region 1470 (write-region
1470 "any text" nil file-notify--test-tmpfile1 t 'no-message) 1471 "any text" nil file-notify--test-tmpfile1 t 'no-message)
diff --git a/test/lisp/files-tests.el b/test/lisp/files-tests.el
index 718ecd51f8b..d4c1ef3ba67 100644
--- a/test/lisp/files-tests.el
+++ b/test/lisp/files-tests.el
@@ -1656,30 +1656,47 @@ The door of all subtleties!
1656 (should (equal (file-name-base "foo") "foo")) 1656 (should (equal (file-name-base "foo") "foo"))
1657 (should (equal (file-name-base "foo/bar") "bar"))) 1657 (should (equal (file-name-base "foo/bar") "bar")))
1658 1658
1659(defun files-tests--check-shebang (shebang expected-mode) 1659(defvar sh-shell)
1660 "Assert that mode for SHEBANG derives from EXPECTED-MODE." 1660
1661 (let ((actual-mode 1661(defun files-tests--check-shebang (shebang expected-mode &optional expected-dialect)
1662 (ert-with-temp-file script-file 1662 "Assert that mode for SHEBANG derives from EXPECTED-MODE.
1663 :text shebang 1663
1664 (find-file script-file) 1664If EXPECTED-MODE is sh-base-mode, DIALECT says what `sh-shell' should be
1665 (if (derived-mode-p expected-mode) 1665set to."
1666 expected-mode 1666 (ert-with-temp-file script-file
1667 major-mode)))) 1667 :text shebang
1668 ;; Tuck all the information we need in the `should' form: input 1668 (find-file script-file)
1669 ;; shebang, expected mode vs actual. 1669 (let ((actual-mode (if (derived-mode-p expected-mode)
1670 (should 1670 expected-mode
1671 (equal (list shebang actual-mode) 1671 major-mode)))
1672 (list shebang expected-mode))))) 1672 ;; Tuck all the information we need in the `should' form: input
1673 ;; shebang, expected mode vs actual.
1674 (should
1675 (equal (list shebang actual-mode)
1676 (list shebang expected-mode)))
1677 (when (eq expected-mode 'sh-base-mode)
1678 (should (eq sh-shell expected-dialect))))))
1673 1679
1674(ert-deftest files-tests-auto-mode-interpreter () 1680(ert-deftest files-tests-auto-mode-interpreter ()
1675 "Test that `set-auto-mode' deduces correct modes from shebangs." 1681 "Test that `set-auto-mode' deduces correct modes from shebangs."
1676 (files-tests--check-shebang "#!/bin/bash" 'sh-mode) 1682 ;; Straightforward interpreter invocation.
1677 (files-tests--check-shebang "#!/usr/bin/env bash" 'sh-mode) 1683 (files-tests--check-shebang "#!/bin/bash" 'sh-base-mode 'bash)
1684 (files-tests--check-shebang "#!/usr/bin/make -f" 'makefile-mode)
1685 ;; Invocation through env.
1686 (files-tests--check-shebang "#!/usr/bin/env bash" 'sh-base-mode 'bash)
1678 (files-tests--check-shebang "#!/usr/bin/env python" 'python-base-mode) 1687 (files-tests--check-shebang "#!/usr/bin/env python" 'python-base-mode)
1679 (files-tests--check-shebang "#!/usr/bin/env python3" 'python-base-mode) 1688 (files-tests--check-shebang "#!/usr/bin/env python3" 'python-base-mode)
1689 ;; Invocation through env, with supplementary arguments.
1690 (files-tests--check-shebang "#!/usr/bin/env --split-string=bash -eux" 'sh-base-mode 'bash)
1691 (files-tests--check-shebang "#!/usr/bin/env --split-string=-iv --default-signal bash -eux" 'sh-base-mode 'bash)
1680 (files-tests--check-shebang "#!/usr/bin/env -S awk -v FS=\"\\t\" -v OFS=\"\\t\" -f" 'awk-mode) 1692 (files-tests--check-shebang "#!/usr/bin/env -S awk -v FS=\"\\t\" -v OFS=\"\\t\" -f" 'awk-mode)
1681 (files-tests--check-shebang "#!/usr/bin/env -S make -f" 'makefile-mode) 1693 (files-tests--check-shebang "#!/usr/bin/env -S make -f" 'makefile-mode)
1682 (files-tests--check-shebang "#!/usr/bin/make -f" 'makefile-mode)) 1694 (files-tests--check-shebang "#!/usr/bin/env -S-vi bash -eux" 'sh-base-mode 'bash)
1695 (files-tests--check-shebang "#!/usr/bin/env -ivS --default-signal=INT bash -eux" 'sh-base-mode 'bash)
1696 (files-tests--check-shebang "#!/usr/bin/env -ivS --default-signal bash -eux" 'sh-base-mode 'bash)
1697 (files-tests--check-shebang "#!/usr/bin/env -vS -uFOOBAR bash -eux" 'sh-base-mode 'bash)
1698 ;; Invocation through env, with modified environment.
1699 (files-tests--check-shebang "#!/usr/bin/env -S PYTHONPATH=/...:${PYTHONPATH} python" 'python-base-mode))
1683 1700
1684(ert-deftest files-test-dir-locals-auto-mode-alist () 1701(ert-deftest files-test-dir-locals-auto-mode-alist ()
1685 "Test an `auto-mode-alist' entry in `.dir-locals.el'" 1702 "Test an `auto-mode-alist' entry in `.dir-locals.el'"
diff --git a/test/lisp/info-tests.el b/test/lisp/info-tests.el
index 0dfdbf417e8..8020a7419cf 100644
--- a/test/lisp/info-tests.el
+++ b/test/lisp/info-tests.el
@@ -28,18 +28,20 @@
28(require 'ert-x) 28(require 'ert-x)
29 29
30(ert-deftest test-info-urls () 30(ert-deftest test-info-urls ()
31 (should (equal (Info-url-for-node "(tramp)Top")
32 "https://www.gnu.org/software/emacs/manual/html_node/tramp/"))
31 (should (equal (Info-url-for-node "(emacs)Minibuffer") 33 (should (equal (Info-url-for-node "(emacs)Minibuffer")
32 "https://www.gnu.org/software/emacs/manual/html_node/emacs/Minibuffer")) 34 "https://www.gnu.org/software/emacs/manual/html_node/emacs/Minibuffer.html"))
33 (should (equal (Info-url-for-node "(emacs)Minibuffer File") 35 (should (equal (Info-url-for-node "(emacs)Minibuffer File")
34 "https://www.gnu.org/software/emacs/manual/html_node/emacs/Minibuffer-File")) 36 "https://www.gnu.org/software/emacs/manual/html_node/emacs/Minibuffer-File.html"))
35 (should (equal (Info-url-for-node "(elisp)Backups and Auto-Saving") 37 (should (equal (Info-url-for-node "(elisp)Backups and Auto-Saving")
36 "https://www.gnu.org/software/emacs/manual/html_node/elisp/Backups-and-Auto_002dSaving")) 38 "https://www.gnu.org/software/emacs/manual/html_node/elisp/Backups-and-Auto_002dSaving.html"))
37 (should (equal (Info-url-for-node "(eintr)car & cdr") 39 (should (equal (Info-url-for-node "(eintr)car & cdr")
38 "https://www.gnu.org/software/emacs/manual/html_node/eintr/car-_0026-cdr")) 40 "https://www.gnu.org/software/emacs/manual/html_node/eintr/car-_0026-cdr.html"))
39 (should (equal (Info-url-for-node "(emacs-mime)\tIndex") 41 (should (equal (Info-url-for-node "(emacs-mime)\tIndex")
40 "https://www.gnu.org/software/emacs/manual/html_node/emacs-mime/Index")) 42 "https://www.gnu.org/software/emacs/manual/html_node/emacs-mime/Index.html"))
41 (should (equal (Info-url-for-node "(gnus) Don't Panic") 43 (should (equal (Info-url-for-node "(gnus) Don't Panic")
42 "https://www.gnu.org/software/emacs/manual/html_node/gnus/Don_0027t-Panic")) 44 "https://www.gnu.org/software/emacs/manual/html_node/gnus/Don_0027t-Panic.html"))
43 (should-error (Info-url-for-node "(nonexistent)Example"))) 45 (should-error (Info-url-for-node "(nonexistent)Example")))
44 46
45;;; info-tests.el ends here 47;;; info-tests.el ends here
diff --git a/test/lisp/international/mule-tests.el b/test/lisp/international/mule-tests.el
index 5c742451a57..9a80ced55ae 100644
--- a/test/lisp/international/mule-tests.el
+++ b/test/lisp/international/mule-tests.el
@@ -96,10 +96,10 @@
96 96
97;;; Testing `sgml-html-meta-auto-coding-function'. 97;;; Testing `sgml-html-meta-auto-coding-function'.
98 98
99(defconst sgml-html-meta-pre "<!doctype html><html><head>" 99(defvar sgml-html-meta-pre "<!doctype html><html><head>"
100 "The beginning of a minimal HTML document.") 100 "The beginning of a minimal HTML document.")
101 101
102(defconst sgml-html-meta-post "</head></html>" 102(defvar sgml-html-meta-post "</head></html>"
103 "The end of a minimal HTML document.") 103 "The end of a minimal HTML document.")
104 104
105(defun sgml-html-meta-run (coding-system) 105(defun sgml-html-meta-run (coding-system)
diff --git a/test/lisp/minibuffer-tests.el b/test/lisp/minibuffer-tests.el
index 07c4dbc3197..c4a7de9e51f 100644
--- a/test/lisp/minibuffer-tests.el
+++ b/test/lisp/minibuffer-tests.el
@@ -201,6 +201,13 @@
201 'completions-first-difference) 201 'completions-first-difference)
202 return pos)) 202 return pos))
203 203
204(ert-deftest completion-test--pcm-bug38458 ()
205 (should (equal (let ((completion-ignore-case t))
206 (completion-pcm--merge-try '("tes" point "ing")
207 '("Testing" "testing")
208 "" ""))
209 '("testing" . 4))))
210
204(ert-deftest completion-pcm-test-1 () 211(ert-deftest completion-pcm-test-1 ()
205 ;; Point is at end, this does not match anything 212 ;; Point is at end, this does not match anything
206 (should (null 213 (should (null
diff --git a/test/lisp/net/tramp-archive-tests.el b/test/lisp/net/tramp-archive-tests.el
index 978342b1bb1..1ca2fa9b9b3 100644
--- a/test/lisp/net/tramp-archive-tests.el
+++ b/test/lisp/net/tramp-archive-tests.el
@@ -77,7 +77,7 @@ A resource file is in the resource directory as per
77`ert-resource-directory'." 77`ert-resource-directory'."
78 `(expand-file-name ,file (ert-resource-directory))))) 78 `(expand-file-name ,file (ert-resource-directory)))))
79 79
80(defconst tramp-archive-test-file-archive (ert-resource-file "foo.tar.gz") 80(defvar tramp-archive-test-file-archive (ert-resource-file "foo.tar.gz")
81 "The test file archive.") 81 "The test file archive.")
82 82
83(defun tramp-archive-test-file-archive-hexlified () 83(defun tramp-archive-test-file-archive-hexlified ()
@@ -86,7 +86,7 @@ Do not hexlify \"/\". This hexlified string is used in `file:///' URLs."
86 (let* ((url-unreserved-chars (cons ?/ url-unreserved-chars))) 86 (let* ((url-unreserved-chars (cons ?/ url-unreserved-chars)))
87 (url-hexify-string tramp-archive-test-file-archive))) 87 (url-hexify-string tramp-archive-test-file-archive)))
88 88
89(defconst tramp-archive-test-archive 89(defvar tramp-archive-test-archive
90 (file-name-as-directory tramp-archive-test-file-archive) 90 (file-name-as-directory tramp-archive-test-file-archive)
91 "The test archive.") 91 "The test archive.")
92 92
diff --git a/test/lisp/net/tramp-tests.el b/test/lisp/net/tramp-tests.el
index 2a3b3e16891..cdd2a1efdb2 100644
--- a/test/lisp/net/tramp-tests.el
+++ b/test/lisp/net/tramp-tests.el
@@ -265,8 +265,8 @@ is greater than 10.
265 `(let* ((tramp-verbose (max (or ,verbose 0) (or tramp-verbose 0))) 265 `(let* ((tramp-verbose (max (or ,verbose 0) (or tramp-verbose 0)))
266 (debug-ignored-errors 266 (debug-ignored-errors
267 (append 267 (append
268 '("^make-symbolic-link not supported$" 268 '("\\`make-symbolic-link not supported\\'"
269 "^error with add-name-to-file") 269 "\\`error with add-name-to-file")
270 debug-ignored-errors)) 270 debug-ignored-errors))
271 inhibit-message) 271 inhibit-message)
272 (unwind-protect 272 (unwind-protect
@@ -379,7 +379,7 @@ is greater than 10.
379 (let (tramp-mode) 379 (let (tramp-mode)
380 (should-not (tramp-tramp-file-p "/method:user@host:"))) 380 (should-not (tramp-tramp-file-p "/method:user@host:")))
381 ;; `tramp-ignored-file-name-regexp' suppresses Tramp. 381 ;; `tramp-ignored-file-name-regexp' suppresses Tramp.
382 (let ((tramp-ignored-file-name-regexp "^/method:user@host:")) 382 (let ((tramp-ignored-file-name-regexp "\\`/method:user@host:"))
383 (should-not (tramp-tramp-file-p "/method:user@host:"))) 383 (should-not (tramp-tramp-file-p "/method:user@host:")))
384 ;; Methods shall be at least two characters, except the 384 ;; Methods shall be at least two characters, except the
385 ;; default method. 385 ;; default method.
@@ -3493,6 +3493,8 @@ This tests also `file-directory-p' and `file-accessible-directory-p'."
3493 (skip-unless (not (tramp--test-rsync-p))) 3493 (skip-unless (not (tramp--test-rsync-p)))
3494 ;; Wildcards are not supported in tramp-crypt.el. 3494 ;; Wildcards are not supported in tramp-crypt.el.
3495 (skip-unless (not (tramp--test-crypt-p))) 3495 (skip-unless (not (tramp--test-crypt-p)))
3496 ;; Wildcards are not supported with "docker cp ..." or "podman cp ...".
3497 (skip-unless (not (tramp--test-container-oob-p)))
3496 3498
3497 (dolist (quoted (if (tramp--test-expensive-test-p) '(nil t) '(nil))) 3499 (dolist (quoted (if (tramp--test-expensive-test-p) '(nil t) '(nil)))
3498 (let* ((tmp-name1 3500 (let* ((tmp-name1
@@ -3815,15 +3817,24 @@ This tests also `access-file', `file-readable-p',
3815 (ignore-errors (delete-file tmp-name1)) 3817 (ignore-errors (delete-file tmp-name1))
3816 (ignore-errors (delete-file tmp-name2)))))) 3818 (ignore-errors (delete-file tmp-name2))))))
3817 3819
3820(defun tramp--test-set-ert-test-documentation (test command)
3821 "Set the documentation string for a derived test.
3822The test is derived from TEST and COMMAND."
3823 (let ((test-doc
3824 (split-string (ert-test-documentation (get test 'ert--test)) "\n")))
3825 ;; The first line must be extended.
3826 (setcar
3827 test-doc (format "%s Use the \"%s\" command." (car test-doc) command))
3828 (setf (ert-test-documentation
3829 (get (intern (format "%s-with-%s" test command)) 'ert--test))
3830 (string-join test-doc "\n"))))
3831
3818(defmacro tramp--test-deftest-with-stat (test) 3832(defmacro tramp--test-deftest-with-stat (test)
3819 "Define ert `TEST-with-stat'." 3833 "Define ert `TEST-with-stat'."
3820 (declare (indent 1)) 3834 (declare (indent 1))
3821 `(ert-deftest ,(intern (concat (symbol-name test) "-with-stat")) () 3835 `(ert-deftest ,(intern (concat (symbol-name test) "-with-stat")) ()
3822 ;; This is the docstring. However, it must be expanded to a
3823 ;; string inside the macro. No idea.
3824 ;; (concat (ert-test-documentation (get ',test 'ert--test))
3825 ;; "\nUse the \"stat\" command.")
3826 :tags '(:expensive-test) 3836 :tags '(:expensive-test)
3837 (tramp--test-set-ert-test-documentation ',test "stat")
3827 (skip-unless (tramp--test-enabled)) 3838 (skip-unless (tramp--test-enabled))
3828 (skip-unless (tramp--test-sh-p)) 3839 (skip-unless (tramp--test-sh-p))
3829 (skip-unless (tramp-get-remote-stat tramp-test-vec)) 3840 (skip-unless (tramp-get-remote-stat tramp-test-vec))
@@ -3842,11 +3853,8 @@ This tests also `access-file', `file-readable-p',
3842 "Define ert `TEST-with-perl'." 3853 "Define ert `TEST-with-perl'."
3843 (declare (indent 1)) 3854 (declare (indent 1))
3844 `(ert-deftest ,(intern (concat (symbol-name test) "-with-perl")) () 3855 `(ert-deftest ,(intern (concat (symbol-name test) "-with-perl")) ()
3845 ;; This is the docstring. However, it must be expanded to a
3846 ;; string inside the macro. No idea.
3847 ;; (concat (ert-test-documentation (get ',test 'ert--test))
3848 ;; "\nUse the \"perl\" command.")
3849 :tags '(:expensive-test) 3856 :tags '(:expensive-test)
3857 (tramp--test-set-ert-test-documentation ',test "perl")
3850 (skip-unless (tramp--test-enabled)) 3858 (skip-unless (tramp--test-enabled))
3851 (skip-unless (tramp--test-sh-p)) 3859 (skip-unless (tramp--test-sh-p))
3852 (skip-unless (tramp-get-remote-perl tramp-test-vec)) 3860 (skip-unless (tramp-get-remote-perl tramp-test-vec))
@@ -3870,11 +3878,8 @@ This tests also `access-file', `file-readable-p',
3870 "Define ert `TEST-with-ls'." 3878 "Define ert `TEST-with-ls'."
3871 (declare (indent 1)) 3879 (declare (indent 1))
3872 `(ert-deftest ,(intern (concat (symbol-name test) "-with-ls")) () 3880 `(ert-deftest ,(intern (concat (symbol-name test) "-with-ls")) ()
3873 ;; This is the docstring. However, it must be expanded to a
3874 ;; string inside the macro. No idea.
3875 ;; (concat (ert-test-documentation (get ',test 'ert--test))
3876 ;; "\nUse the \"ls\" command.")
3877 :tags '(:expensive-test) 3881 :tags '(:expensive-test)
3882 (tramp--test-set-ert-test-documentation ',test "ls")
3878 (skip-unless (tramp--test-enabled)) 3883 (skip-unless (tramp--test-enabled))
3879 (skip-unless (tramp--test-sh-p)) 3884 (skip-unless (tramp--test-sh-p))
3880 (if-let ((default-directory ert-remote-temporary-file-directory) 3885 (if-let ((default-directory ert-remote-temporary-file-directory)
@@ -5155,8 +5160,8 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'."
5155 (should-not (get-buffer-window (current-buffer) t)) 5160 (should-not (get-buffer-window (current-buffer) t))
5156 (delete-file tmp-name))) 5161 (delete-file tmp-name)))
5157 5162
5158 ;; Check remote and local DESTNATION file. This isn't 5163 ;; Check remote and local DESTINATION file. This isn't
5159 ;; implemented yet ina all file name handler backends. 5164 ;; implemented yet in all file name handler backends.
5160 ;; (dolist (local '(nil t)) 5165 ;; (dolist (local '(nil t))
5161 ;; (setq tmp-name (tramp--test-make-temp-name local quoted)) 5166 ;; (setq tmp-name (tramp--test-make-temp-name local quoted))
5162 ;; (should 5167 ;; (should
@@ -6376,33 +6381,35 @@ INPUT, if non-nil, is a string sent to the process."
6376 (setq tramp-remote-path orig-tramp-remote-path) 6381 (setq tramp-remote-path orig-tramp-remote-path)
6377 6382
6378 ;; We make a super long `tramp-remote-path'. 6383 ;; We make a super long `tramp-remote-path'.
6379 (make-directory tmp-name) 6384 (unless (tramp--test-container-oob-p)
6380 (should (file-directory-p tmp-name)) 6385 (make-directory tmp-name)
6381 (while (tramp-compat-length< (string-join orig-exec-path ":") 5000) 6386 (should (file-directory-p tmp-name))
6382 (let ((dir (make-temp-file (file-name-as-directory tmp-name) 'dir))) 6387 (while (tramp-compat-length< (string-join orig-exec-path ":") 5000)
6383 (should (file-directory-p dir)) 6388 (let ((dir (make-temp-file
6384 (setq tramp-remote-path 6389 (file-name-as-directory tmp-name) 'dir)))
6385 (append 6390 (should (file-directory-p dir))
6386 tramp-remote-path `(,(file-remote-p dir 'localname))) 6391 (setq tramp-remote-path
6387 orig-exec-path 6392 (append
6388 (append 6393 tramp-remote-path `(,(file-remote-p dir 'localname)))
6389 (butlast orig-exec-path) 6394 orig-exec-path
6390 `(,(file-remote-p dir 'localname)) 6395 (append
6391 (last orig-exec-path))))) 6396 (butlast orig-exec-path)
6392 (tramp-cleanup-connection tramp-test-vec 'keep-debug 'keep-password) 6397 `(,(file-remote-p dir 'localname))
6393 (should (equal (exec-path) orig-exec-path)) 6398 (last orig-exec-path)))))
6394 ;; Ignore trailing newline. 6399 (tramp-cleanup-connection tramp-test-vec 'keep-debug 'keep-password)
6395 (setq path (substring (shell-command-to-string "echo $PATH") nil -1)) 6400 (should (equal (exec-path) orig-exec-path))
6396 ;; The shell doesn't handle such long strings. 6401 ;; Ignore trailing newline.
6397 (unless (tramp-compat-length> 6402 (setq path (substring (shell-command-to-string "echo $PATH") nil -1))
6398 path 6403 ;; The shell doesn't handle such long strings.
6399 (tramp-get-connection-property 6404 (unless (tramp-compat-length>
6400 tramp-test-vec "pipe-buf" 4096)) 6405 path
6401 ;; The last element of `exec-path' is `exec-directory'. 6406 (tramp-get-connection-property
6402 (should 6407 tramp-test-vec "pipe-buf" 4096))
6403 (string-equal path (string-join (butlast orig-exec-path) ":")))) 6408 ;; The last element of `exec-path' is `exec-directory'.
6404 ;; The shell "sh" shall always exist. 6409 (should
6405 (should (executable-find "sh" 'remote))) 6410 (string-equal path (string-join (butlast orig-exec-path) ":"))))
6411 ;; The shell "sh" shall always exist.
6412 (should (executable-find "sh" 'remote))))
6406 6413
6407 ;; Cleanup. 6414 ;; Cleanup.
6408 (tramp-cleanup-connection tramp-test-vec 'keep-debug 'keep-password) 6415 (tramp-cleanup-connection tramp-test-vec 'keep-debug 'keep-password)
@@ -7053,17 +7060,24 @@ This is used in tests which we don't want to tag
7053 (not (and (tramp--test-adb-p) 7060 (not (and (tramp--test-adb-p)
7054 (string-match-p (rx multibyte) default-directory))))) 7061 (string-match-p (rx multibyte) default-directory)))))
7055 7062
7056(defun tramp--test-crypt-p ()
7057 "Check, whether the remote directory is encrypted."
7058 (tramp-crypt-file-name-p ert-remote-temporary-file-directory))
7059
7060(defun tramp--test-container-p () 7063(defun tramp--test-container-p ()
7061 "Check, whether a container method is used. 7064 "Check, whether a container method is used.
7062This does not support some special file names." 7065This does not support some special file names."
7063 (string-match-p 7066 (string-match-p
7064 (rx bol (| "docker" "podman") eol) 7067 (rx bol (| "docker" "podman"))
7065 (file-remote-p ert-remote-temporary-file-directory 'method))) 7068 (file-remote-p ert-remote-temporary-file-directory 'method)))
7066 7069
7070(defun tramp--test-container-oob-p ()
7071 "Check, whether the dockercp or podmancp method is used.
7072They does not support wildcard copy."
7073 (string-match-p
7074 (rx bol (| "dockercp" "podmancp") eol)
7075 (file-remote-p ert-remote-temporary-file-directory 'method)))
7076
7077(defun tramp--test-crypt-p ()
7078 "Check, whether the remote directory is encrypted."
7079 (tramp-crypt-file-name-p ert-remote-temporary-file-directory))
7080
7067(defun tramp--test-expensive-test-p () 7081(defun tramp--test-expensive-test-p ()
7068 "Whether expensive tests are run. 7082 "Whether expensive tests are run.
7069This is used in tests which we don't want to tag `:expensive' 7083This is used in tests which we don't want to tag `:expensive'
@@ -7480,7 +7494,8 @@ This requires restrictions of file name syntax."
7480 (tramp--test-gvfs-p) 7494 (tramp--test-gvfs-p)
7481 (tramp--test-windows-nt-or-smb-p)) 7495 (tramp--test-windows-nt-or-smb-p))
7482 "?foo?bar?baz?") 7496 "?foo?bar?baz?")
7483 (unless (or (tramp--test-ftp-p) 7497 (unless (or (tramp--test-container-oob-p)
7498 (tramp--test-ftp-p)
7484 (tramp--test-gvfs-p) 7499 (tramp--test-gvfs-p)
7485 (tramp--test-windows-nt-or-smb-p)) 7500 (tramp--test-windows-nt-or-smb-p))
7486 "*foo+bar*baz+") 7501 "*foo+bar*baz+")
@@ -7500,7 +7515,10 @@ This requires restrictions of file name syntax."
7500 (unless (or (tramp--test-gvfs-p) (tramp--test-windows-nt-or-smb-p)) 7515 (unless (or (tramp--test-gvfs-p) (tramp--test-windows-nt-or-smb-p))
7501 "<foo>bar<baz>") 7516 "<foo>bar<baz>")
7502 "(foo)bar(baz)" 7517 "(foo)bar(baz)"
7503 (unless (or (tramp--test-ftp-p) (tramp--test-gvfs-p)) "[foo]bar[baz]") 7518 (unless (or (tramp--test-container-oob-p)
7519 (tramp--test-ftp-p)
7520 (tramp--test-gvfs-p))
7521 "[foo]bar[baz]")
7504 "{foo}bar{baz}"))) 7522 "{foo}bar{baz}")))
7505 ;; Simplify test in order to speed up. 7523 ;; Simplify test in order to speed up.
7506 (apply #'tramp--test-check-files 7524 (apply #'tramp--test-check-files
diff --git a/test/lisp/obarray-tests.el b/test/lisp/obarray-tests.el
index d7e547fcf29..f9f97dba535 100644
--- a/test/lisp/obarray-tests.el
+++ b/test/lisp/obarray-tests.el
@@ -32,27 +32,18 @@
32 (should-not (obarrayp "aoeu")) 32 (should-not (obarrayp "aoeu"))
33 (should-not (obarrayp '())) 33 (should-not (obarrayp '()))
34 (should-not (obarrayp [])) 34 (should-not (obarrayp []))
35 (should (obarrayp (make-vector 7 0))))
36
37(ert-deftest obarrayp-unchecked-content-test ()
38 "Should fail to check content of passed obarray."
39 :expected-result :failed
40 (should-not (obarrayp ["a" "b" "c"])) 35 (should-not (obarrayp ["a" "b" "c"]))
41 (should-not (obarrayp [1 2 3]))) 36 (should-not (obarrayp [1 2 3]))
42 37 (should-not (obarrayp (make-vector 7 0)))
43(ert-deftest obarray-make-default-test () 38 (should-not (obarrayp (vector (obarray-make))))
44 (let ((table (obarray-make))) 39 (should (obarrayp (obarray-make)))
45 (should (obarrayp table)) 40 (should (obarrayp (obarray-make 7))))
46 (should (eq (obarray-size table) obarray-default-size))))
47 41
48(ert-deftest obarray-make-with-size-test () 42(ert-deftest obarray-make-with-size-test ()
49 ;; FIXME: Actually, `wrong-type-argument' is not the right error to signal, 43 ;; FIXME: Actually, `wrong-type-argument' is not the right error to signal,
50 ;; so we shouldn't enforce this misbehavior in tests! 44 ;; so we shouldn't enforce this misbehavior in tests!
51 (should-error (obarray-make -1) :type 'wrong-type-argument) 45 (should-error (obarray-make -1) :type 'wrong-type-argument)
52 (should-error (obarray-make 0) :type 'wrong-type-argument) 46 (should-error (obarray-make 'a) :type 'wrong-type-argument))
53 (let ((table (obarray-make 1)))
54 (should (obarrayp table))
55 (should (eq (obarray-size table) 1))))
56 47
57(ert-deftest obarray-get-test () 48(ert-deftest obarray-get-test ()
58 (let ((table (obarray-make 3))) 49 (let ((table (obarray-make 3)))
@@ -88,5 +79,15 @@
88 (obarray-map collect-names table) 79 (obarray-map collect-names table)
89 (should (equal (sort syms #'string<) '("a" "b" "c"))))) 80 (should (equal (sort syms #'string<) '("a" "b" "c")))))
90 81
82(ert-deftest obarray-clear ()
83 (let ((o (obarray-make)))
84 (intern "a" o)
85 (intern "b" o)
86 (intern "c" o)
87 (obarray-clear o)
88 (let ((n 0))
89 (mapatoms (lambda (_) (setq n (1+ n))) o)
90 (should (equal n 0)))))
91
91(provide 'obarray-tests) 92(provide 'obarray-tests)
92;;; obarray-tests.el ends here 93;;; obarray-tests.el ends here
diff --git a/test/lisp/progmodes/java-ts-mode-resources/indent.erts b/test/lisp/progmodes/java-ts-mode-resources/indent.erts
index 4fca74dd2e1..514d2e08977 100644
--- a/test/lisp/progmodes/java-ts-mode-resources/indent.erts
+++ b/test/lisp/progmodes/java-ts-mode-resources/indent.erts
@@ -110,3 +110,34 @@ public class Java {
110 } 110 }
111} 111}
112=-=-= 112=-=-=
113
114Name: Opening bracket on separate line (bug#67556)
115
116=-=
117public class Java {
118 void foo(
119 String foo)
120 {
121 for (var f : rs)
122 return new String[]
123 {
124 "foo",
125 "bar"
126 };
127 if (a == 0)
128 {
129 return 0;
130 } else if (a == 1)
131 {
132 return 1;
133 }
134
135 switch(expr)
136 {
137 case x:
138 // code block
139 break;
140 }
141 }
142}
143=-=-=
diff --git a/test/lisp/progmodes/python-tests.el b/test/lisp/progmodes/python-tests.el
index 59957ff0712..1ceee690cfb 100644
--- a/test/lisp/progmodes/python-tests.el
+++ b/test/lisp/progmodes/python-tests.el
@@ -55,21 +55,27 @@ BODY is code to be executed within the temp buffer. Point is
55always located at the beginning of buffer. Native completion is 55always located at the beginning of buffer. Native completion is
56turned off. Shell buffer will be killed on exit." 56turned off. Shell buffer will be killed on exit."
57 (declare (indent 1) (debug t)) 57 (declare (indent 1) (debug t))
58 `(with-temp-buffer 58 (let ((dir (make-symbol "dir")))
59 (let ((python-indent-guess-indent-offset nil) 59 `(with-temp-buffer
60 (python-shell-completion-native-enable nil)) 60 (let ((python-indent-guess-indent-offset nil)
61 (python-mode) 61 (python-shell-completion-native-enable nil))
62 (unwind-protect 62 (python-mode)
63 (progn 63 (unwind-protect
64 (run-python nil t) 64 ;; Prevent test failures when Jedi is used as a completion
65 (insert ,contents) 65 ;; backend, either directly or indirectly (e.g., via
66 (goto-char (point-min)) 66 ;; IPython). Jedi needs to store cache, but the
67 (python-tests-shell-wait-for-prompt) 67 ;; "/nonexistent" HOME directory is not writable.
68 ,@body) 68 (ert-with-temp-directory ,dir
69 (when (python-shell-get-buffer) 69 (with-environment-variables (("XDG_CACHE_HOME" ,dir))
70 (python-shell-with-shell-buffer 70 (run-python nil t)
71 (let (kill-buffer-hook kill-buffer-query-functions) 71 (insert ,contents)
72 (kill-buffer)))))))) 72 (goto-char (point-min))
73 (python-tests-shell-wait-for-prompt)
74 ,@body))
75 (when (python-shell-get-buffer)
76 (python-shell-with-shell-buffer
77 (let (kill-buffer-hook kill-buffer-query-functions)
78 (kill-buffer)))))))))
73 79
74(defmacro python-tests-with-temp-file (contents &rest body) 80(defmacro python-tests-with-temp-file (contents &rest body)
75 "Create a `python-mode' enabled file with CONTENTS. 81 "Create a `python-mode' enabled file with CONTENTS.
@@ -4799,6 +4805,111 @@ def foo():
4799 (end-of-line 0) 4805 (end-of-line 0)
4800 (should-not (nth 2 (python-shell-completion-at-point)))))) 4806 (should-not (nth 2 (python-shell-completion-at-point))))))
4801 4807
4808(defun python-tests--completion-module ()
4809 "Check if modules can be completed in Python shell."
4810 (insert "import datet")
4811 (completion-at-point)
4812 (beginning-of-line)
4813 (should (looking-at-p "import datetime"))
4814 (kill-line)
4815 (insert "from datet")
4816 (completion-at-point)
4817 (beginning-of-line)
4818 (should (looking-at-p "from datetime"))
4819 (end-of-line)
4820 (insert " import timed")
4821 (completion-at-point)
4822 (beginning-of-line)
4823 (should (looking-at-p "from datetime import timedelta"))
4824 (kill-line))
4825
4826(defun python-tests--completion-parameters ()
4827 "Check if parameters can be completed in Python shell."
4828 (insert "import re")
4829 (comint-send-input)
4830 (python-tests-shell-wait-for-prompt)
4831 (insert "re.split('b', 'abc', maxs")
4832 (completion-at-point)
4833 (should (string= "re.split('b', 'abc', maxsplit="
4834 (buffer-substring (line-beginning-position) (point))))
4835 (insert "0, ")
4836 (should (python-shell-completion-at-point))
4837 ;; Test if cache is used.
4838 (cl-letf (((symbol-function 'python-shell-completion-get-completions)
4839 'ignore)
4840 ((symbol-function 'python-shell-completion-native-get-completions)
4841 'ignore))
4842 (insert "fla")
4843 (completion-at-point)
4844 (should (string= "re.split('b', 'abc', maxsplit=0, flags="
4845 (buffer-substring (line-beginning-position) (point)))))
4846 (beginning-of-line)
4847 (kill-line))
4848
4849(defun python-tests--completion-extra-context ()
4850 "Check if extra context is used for completion."
4851 (insert "re.split('b', 'abc',")
4852 (comint-send-input)
4853 (python-tests-shell-wait-for-prompt)
4854 (insert "maxs")
4855 (completion-at-point)
4856 (should (string= "maxsplit="
4857 (buffer-substring (line-beginning-position) (point))))
4858 (insert "0)")
4859 (comint-send-input)
4860 (python-tests-shell-wait-for-prompt)
4861 (insert "from re import (")
4862 (comint-send-input)
4863 (python-tests-shell-wait-for-prompt)
4864 (insert "IGN")
4865 (completion-at-point)
4866 (should (string= "IGNORECASE"
4867 (buffer-substring (line-beginning-position) (point)))))
4868
4869(defun python-tests--pythonstartup-file ()
4870 "Return Jedi readline setup file if PYTHONSTARTUP is not set."
4871 (or (getenv "PYTHONSTARTUP")
4872 (with-temp-buffer
4873 (if (eql 0 (call-process python-tests-shell-interpreter
4874 nil t nil "-m" "jedi" "repl"))
4875 (string-trim (buffer-string))
4876 ""))))
4877
4878(ert-deftest python-shell-completion-at-point-jedi-completer ()
4879 "Check if Python shell completion works when Jedi completer is used."
4880 (skip-unless (executable-find python-tests-shell-interpreter))
4881 (with-environment-variables
4882 (("PYTHONSTARTUP" (python-tests--pythonstartup-file)))
4883 (python-tests-with-temp-buffer-with-shell
4884 ""
4885 (python-shell-with-shell-buffer
4886 (python-shell-completion-native-turn-on)
4887 (skip-unless (string= python-shell-readline-completer-delims ""))
4888 (python-tests--completion-module)
4889 (python-tests--completion-parameters)
4890 (python-tests--completion-extra-context)))))
4891
4892(ert-deftest python-shell-completion-at-point-ipython ()
4893 "Check if Python shell completion works for IPython."
4894 (let ((python-shell-interpreter "ipython")
4895 (python-shell-interpreter-args "-i --simple-prompt"))
4896 (skip-unless
4897 (and
4898 (executable-find python-shell-interpreter)
4899 (eql (call-process python-shell-interpreter nil nil nil "--version") 0)))
4900 (with-environment-variables
4901 (("PYTHONSTARTUP" (python-tests--pythonstartup-file)))
4902 (python-tests-with-temp-buffer-with-shell
4903 ""
4904 (python-shell-with-shell-buffer
4905 (python-shell-completion-native-turn-off)
4906 (python-tests--completion-module)
4907 (python-tests--completion-parameters)
4908 (python-shell-completion-native-turn-on)
4909 (skip-unless (string= python-shell-readline-completer-delims ""))
4910 (python-tests--completion-module)
4911 (python-tests--completion-parameters)
4912 (python-tests--completion-extra-context))))))
4802 4913
4803 4914
4804;;; PDB Track integration 4915;;; PDB Track integration
@@ -4945,11 +5056,6 @@ import abc
4945 5056
4946(ert-deftest python-ffap-module-path-1 () 5057(ert-deftest python-ffap-module-path-1 ()
4947 (skip-unless (executable-find python-tests-shell-interpreter)) 5058 (skip-unless (executable-find python-tests-shell-interpreter))
4948 ;; Skip the test on macOS, since the standard Python installation uses
4949 ;; libedit rather than readline which confuses the running of an inferior
4950 ;; interpreter in this case (see bug#59477 and bug#25753).
4951 (skip-when (eq system-type 'darwin))
4952 (trace-function 'python-shell-output-filter)
4953 (python-tests-with-temp-buffer-with-shell 5059 (python-tests-with-temp-buffer-with-shell
4954 " 5060 "
4955import abc 5061import abc
diff --git a/test/lisp/thingatpt-tests.el b/test/lisp/thingatpt-tests.el
index ba51f375cc6..e50738f1122 100644
--- a/test/lisp/thingatpt-tests.el
+++ b/test/lisp/thingatpt-tests.el
@@ -92,6 +92,8 @@
92 ("1@example.com" 1 email "1@example.com") 92 ("1@example.com" 1 email "1@example.com")
93 ;; email addresses user portion containing dots 93 ;; email addresses user portion containing dots
94 ("foo.bar@example.com" 1 email "foo.bar@example.com") 94 ("foo.bar@example.com" 1 email "foo.bar@example.com")
95 ("foo.bar@example.com" 5 email "foo.bar@example.com")
96 (" fo.ba@example.com" 6 email "fo.ba@example.com")
95 (".foobar@example.com" 1 email nil) 97 (".foobar@example.com" 1 email nil)
96 (".foobar@example.com" 2 email "foobar@example.com") 98 (".foobar@example.com" 2 email "foobar@example.com")
97 ;; email addresses domain portion containing dots and dashes 99 ;; email addresses domain portion containing dots and dashes
@@ -180,6 +182,13 @@ position to retrieve THING.")
180 (should (thing-at-point-looking-at "2abcd")) 182 (should (thing-at-point-looking-at "2abcd"))
181 (should (equal (match-data) m2))))) 183 (should (equal (match-data) m2)))))
182 184
185(ert-deftest thing-at-point-looking-at-overlapping-matches ()
186 (with-temp-buffer
187 (insert "foo.bar.baz")
188 (goto-char (point-max))
189 (should (thing-at-point-looking-at "[a-z]+\\.[a-z]+"))
190 (should (string= "bar.baz" (match-string 0)))))
191
183(ert-deftest test-symbol-thing-1 () 192(ert-deftest test-symbol-thing-1 ()
184 (with-temp-buffer 193 (with-temp-buffer
185 (insert "foo bar zot") 194 (insert "foo bar zot")