aboutsummaryrefslogtreecommitdiffstats
path: root/test/lisp
diff options
context:
space:
mode:
authorPo Lu2023-01-11 16:07:32 +0800
committerPo Lu2023-01-11 16:07:32 +0800
commit2fa5583d96fe78ff66d6fd41f18e54e4e20ea7d6 (patch)
treed3cf4a755e2da9b11c284763ed20041033b5dc3b /test/lisp
parent494bedde3235f9034746c977260bbbc2c1e51d8c (diff)
parent033f2cc6140d03e78403f37689b9f54b64bded01 (diff)
downloademacs-2fa5583d96fe78ff66d6fd41f18e54e4e20ea7d6.tar.gz
emacs-2fa5583d96fe78ff66d6fd41f18e54e4e20ea7d6.zip
Merge remote-tracking branch 'origin/master' into feature/android
Diffstat (limited to 'test/lisp')
-rw-r--r--test/lisp/erc/erc-scenarios-base-association.el49
-rw-r--r--test/lisp/erc/erc-services-tests.el9
-rw-r--r--test/lisp/erc/resources/erc-d/erc-d-t.el2
-rw-r--r--test/lisp/erc/resources/networks/merge-server/track.eld44
-rw-r--r--test/lisp/net/tramp-tests.el44
-rw-r--r--test/lisp/progmodes/python-tests.el10
-rw-r--r--test/lisp/progmodes/ruby-mode-resources/ruby.rb2
7 files changed, 153 insertions, 7 deletions
diff --git a/test/lisp/erc/erc-scenarios-base-association.el b/test/lisp/erc/erc-scenarios-base-association.el
index 1e280d0fdd7..a40a4cb7550 100644
--- a/test/lisp/erc/erc-scenarios-base-association.el
+++ b/test/lisp/erc/erc-scenarios-base-association.el
@@ -26,7 +26,9 @@
26 26
27(declare-function erc-network-name "erc-networks") 27(declare-function erc-network-name "erc-networks")
28(declare-function erc-network "erc-networks") 28(declare-function erc-network "erc-networks")
29(declare-function erc-track-get-active-buffer "erc-track" (arg))
29(defvar erc-autojoin-channels-alist) 30(defvar erc-autojoin-channels-alist)
31(defvar erc-track-mode)
30(defvar erc-network) 32(defvar erc-network)
31 33
32;; Two networks, same channel name, no confusion (no bouncer). Some 34;; Two networks, same channel name, no confusion (no bouncer). Some
@@ -190,4 +192,51 @@
190 (with-current-buffer "#chan@barnet" 192 (with-current-buffer "#chan@barnet"
191 (erc-d-t-search-for 10 "I'll bid adieu"))))) 193 (erc-d-t-search-for 10 "I'll bid adieu")))))
192 194
195;; Some modules may need to perform housekeeping when a newly
196;; connected server buffer is deemed a duplicate after its persistent
197;; network context is discovered on MOTD end. One such module is
198;; `track', which needs to rid its list of modified channels of the
199;; buffer being killed. Without this, a user may encounter an
200;; "Attempt to display deleted buffer" error when they try switching
201;; to it.
202
203(ert-deftest erc-scenarios-networks-merge-server-track ()
204 :tags '(:expensive-test)
205 (erc-scenarios-common-with-cleanup
206 ((erc-scenarios-common-dialog "networks/merge-server")
207 (dumb-server (erc-d-run "localhost" t 'track 'track))
208 (port (process-contact dumb-server :service))
209 (erc-server-flood-penalty 0.1)
210 (expect (erc-d-t-make-expecter)))
211
212 (ert-info ("Connect")
213 (with-current-buffer (erc :server "127.0.0.1"
214 :port port
215 :nick "tester")
216 (should (string= (buffer-name) (format "127.0.0.1:%d" port)))
217 (should erc-track-mode)
218 (funcall expect 5 "changed mode for tester")
219 (erc-cmd-JOIN "#chan")))
220
221 (ert-info ("Join channel and quit")
222 (with-current-buffer (erc-d-t-wait-for 10 (get-buffer "#chan"))
223 (funcall expect 5 "The hour that fools should ask")
224 (erc-cmd-QUIT ""))
225 (with-current-buffer "FooNet"
226 (funcall expect 5 "finished")))
227
228 (ert-info ("Reconnect")
229 (with-current-buffer (erc :server "127.0.0.1"
230 :port port
231 :nick "tester")
232 (should (string= (buffer-name) (format "127.0.0.1:%d" port)))
233 (funcall expect 5 "changed mode for tester")))
234
235 (with-current-buffer "#chan"
236 (funcall expect 5 "The hour that fools should ask")
237 ;; Simulate the old `erc-track-switch-buffer'
238 (switch-to-buffer (erc-track-get-active-buffer 1))
239 (erc-d-t-wait-for 10 (eq (get-buffer "FooNet") (current-buffer)))
240 (erc-cmd-QUIT ""))))
241
193;;; erc-scenarios-base-association.el ends here 242;;; erc-scenarios-base-association.el ends here
diff --git a/test/lisp/erc/erc-services-tests.el b/test/lisp/erc/erc-services-tests.el
index b1d36d868eb..9181a47ee3b 100644
--- a/test/lisp/erc/erc-services-tests.el
+++ b/test/lisp/erc/erc-services-tests.el
@@ -248,7 +248,8 @@
248 (let ((auth-sources (list plstore-file)) 248 (let ((auth-sources (list plstore-file))
249 (auth-source-do-cache nil)) 249 (auth-source-do-cache nil))
250 (erc-services-tests--auth-source-standard 250 (erc-services-tests--auth-source-standard
251 #'erc-services-test--call-with-plstore)))) 251 #'erc-services-test--call-with-plstore))
252 (kill-buffer (get-file-buffer plstore-file))))
252 253
253(ert-deftest erc--auth-source-search--plstore-announced () 254(ert-deftest erc--auth-source-search--plstore-announced ()
254 (ert-with-temp-file plstore-file 255 (ert-with-temp-file plstore-file
@@ -264,7 +265,8 @@
264 (let ((auth-sources (list plstore-file)) 265 (let ((auth-sources (list plstore-file))
265 (auth-source-do-cache nil)) 266 (auth-source-do-cache nil))
266 (erc-services-tests--auth-source-announced 267 (erc-services-tests--auth-source-announced
267 #'erc-services-test--call-with-plstore)))) 268 #'erc-services-test--call-with-plstore))
269 (kill-buffer (get-file-buffer plstore-file))))
268 270
269(ert-deftest erc--auth-source-search--plstore-overrides () 271(ert-deftest erc--auth-source-search--plstore-overrides ()
270 (ert-with-temp-file plstore-file 272 (ert-with-temp-file plstore-file
@@ -296,7 +298,8 @@
296 (let ((auth-sources (list plstore-file)) 298 (let ((auth-sources (list plstore-file))
297 (auth-source-do-cache nil)) 299 (auth-source-do-cache nil))
298 (erc-services-tests--auth-source-overrides 300 (erc-services-tests--auth-source-overrides
299 #'erc-services-test--call-with-plstore)))) 301 #'erc-services-test--call-with-plstore))
302 (kill-buffer (get-file-buffer plstore-file))))
300 303
301;; auth-source JSON backend 304;; auth-source JSON backend
302 305
diff --git a/test/lisp/erc/resources/erc-d/erc-d-t.el b/test/lisp/erc/resources/erc-d/erc-d-t.el
index 282c193b707..7b2adf4f07b 100644
--- a/test/lisp/erc/resources/erc-d/erc-d-t.el
+++ b/test/lisp/erc/resources/erc-d/erc-d-t.el
@@ -32,7 +32,7 @@
32 (dolist (buf (buffer-list)) 32 (dolist (buf (buffer-list))
33 (with-current-buffer buf 33 (with-current-buffer buf
34 (when (or erc-d-u--process-buffer 34 (when (or erc-d-u--process-buffer
35 (derived-mode-p 'erc-mode)) 35 (derived-mode-p 'erc-mode 'erc-dcc-chat-mode))
36 (push buf buflist)))) 36 (push buf buflist))))
37 (dolist (buf buflist) 37 (dolist (buf buflist)
38 (when (and (boundp 'erc-server-flood-timer) 38 (when (and (boundp 'erc-server-flood-timer)
diff --git a/test/lisp/erc/resources/networks/merge-server/track.eld b/test/lisp/erc/resources/networks/merge-server/track.eld
new file mode 100644
index 00000000000..4a97f92f722
--- /dev/null
+++ b/test/lisp/erc/resources/networks/merge-server/track.eld
@@ -0,0 +1,44 @@
1;; -*- mode: lisp-data; -*-
2((nick 10 "NICK tester"))
3((user 10 "USER user 0 * :unknown")
4 (0.00 ":irc.example.net NOTICE * :*** Looking up your hostname...")
5 (0.01 ":irc.example.net NOTICE tester :*** Could not resolve your hostname: Domain not found; using your IP address (10.0.2.100) instead.")
6 (0.10 ":irc.example.net 001 tester :Welcome to the FooNet IRC Network tester!user@10.0.2.100")
7 (0.02 ":irc.example.net 002 tester :Your host is irc.example.net, running version InspIRCd-3")
8 (0.02 ":irc.example.net 003 tester :This server was created 05:58:57 Jan 04 2023")
9 (0.01 ":irc.example.net 004 tester irc.example.net InspIRCd-3 BIRcgikorsw ACHIKMORTXabcefghijklmnopqrstvz :HIXabefghjkloqv")
10 (0.00 ":irc.example.net 005 tester ACCEPT=30 AWAYLEN=200 BOT=B CALLERID=g CASEMAPPING=ascii CHANLIMIT=#:20 CHANMODES=IXbeg,k,Hfjl,ACKMORTcimnprstz CHANNELLEN=64 CHANTYPES=# ELIST=CMNTU ESILENCE=CcdiNnPpTtx EXCEPTS=e :are supported by this server")
11 (0.02 ":irc.example.net 005 tester EXTBAN=,ACORTUacjrwz HOSTLEN=64 INVEX=I KEYLEN=32 KICKLEN=255 LINELEN=512 MAXLIST=I:100,X:100,b:100,e:100,g:100 MAXTARGETS=20 MODES=20 MONITOR=30 NAMELEN=128 NAMESX NETWORK=FooNet :are supported by this server")
12 (0.01 ":irc.example.net 005 tester NICKLEN=30 PREFIX=(qaohv)~&@%+ SAFELIST SILENCE=32 STATUSMSG=~&@%+ TOPICLEN=307 UHNAMES USERIP USERLEN=10 USERMODES=,,s,BIRcgikorw WHOX :are supported by this server")
13 (0.01 ":irc.example.net 251 tester :There are 2 users and 0 invisible on 2 servers")
14 (0.01 ":irc.example.net 253 tester 1 :unknown connections")
15 (0.01 ":irc.example.net 254 tester 1 :channels formed")
16 (0.00 ":irc.example.net 255 tester :I have 2 clients and 1 servers")
17 (0.00 ":irc.example.net 265 tester :Current local users: 2 Max: 3")
18 (0.00 ":irc.example.net 266 tester :Current global users: 2 Max: 3")
19 (0.00 ":irc.example.net 375 tester :irc.example.net message of the day")
20 (0.00 ":irc.example.net 372 tester : Have fun with the image!")
21 (0.00 ":irc.example.net 376 tester :End of message of the day."))
22
23((mode 10 "MODE tester +i")
24 (0.00 ":irc.example.net 501 tester x :is not a recognised user mode.")
25 (0.00 ":NickServ!NickServ@services.int NOTICE tester :Welcome to FooNet, tester! Here on FooNet, we provide services to enable the registration of nicknames and channels! For details, type \2/msg NickServ help\2 and \2/msg ChanServ help\2.")
26 (0.02 ":tester!user@10.0.2.100 MODE tester :+i"))
27
28((join 10 "JOIN #chan")
29 (0.01 ":tester!user@10.0.2.100 JOIN :#chan"))
30
31((mode 10 "MODE #chan")
32 (0.01 ":irc.example.net 353 tester = #chan :@alice bob tester")
33 (0.01 ":irc.example.net 366 tester #chan :End of /NAMES list.")
34 (0.00 ":alice!alice@0::1 PRIVMSG #chan :tester, welcome!")
35 (0.02 ":bob!bob@0::1 PRIVMSG #chan :tester, welcome!")
36 (0.02 ":irc.example.net 324 tester #chan :+nt")
37 (0.01 ":irc.example.net 329 tester #chan :1672811954")
38 (0.07 ":alice!alice@0::1 PRIVMSG #chan :bob: This afternoon, sir ? well, she shall be there.")
39 (0.05 ":bob!bob@0::1 PRIVMSG #chan :alice: The hour that fools should ask."))
40
41((quit 10 "QUIT :\2ERC\2")
42 (0.04 "ERROR :Closing link: (user@10.0.2.100) [Quit: \2ERC\2]"))
43
44((drop 1 DROP))
diff --git a/test/lisp/net/tramp-tests.el b/test/lisp/net/tramp-tests.el
index 90f6fcd6b15..dd3de27d3b9 100644
--- a/test/lisp/net/tramp-tests.el
+++ b/test/lisp/net/tramp-tests.el
@@ -80,6 +80,9 @@
80(defvar remote-file-name-inhibit-locks) 80(defvar remote-file-name-inhibit-locks)
81(defvar dired-copy-dereference) 81(defvar dired-copy-dereference)
82 82
83;; Declared in Emacs 30.
84(defvar remote-file-name-inhibit-delete-by-moving-to-trash)
85
83;; `ert-resource-file' was introduced in Emacs 28.1. 86;; `ert-resource-file' was introduced in Emacs 28.1.
84(unless (macrop 'ert-resource-file) 87(unless (macrop 'ert-resource-file)
85 (eval-and-compile 88 (eval-and-compile
@@ -2345,7 +2348,24 @@ This checks also `file-name-as-directory', `file-name-directory',
2345 (expand-file-name 2348 (expand-file-name
2346 (file-name-nondirectory tmp-name) trash-directory)))) 2349 (file-name-nondirectory tmp-name) trash-directory))))
2347 (delete-directory trash-directory 'recursive) 2350 (delete-directory trash-directory 'recursive)
2348 (should-not (file-exists-p trash-directory))))))) 2351 (should-not (file-exists-p trash-directory))))
2352
2353 ;; Setting `remote-file-name-inhibit-delete-by-moving-to-trash'
2354 ;; prevents trashing remote files.
2355 (let ((trash-directory (tramp--test-make-temp-name 'local quoted))
2356 (delete-by-moving-to-trash t)
2357 (remote-file-name-inhibit-delete-by-moving-to-trash t))
2358 (make-directory trash-directory)
2359 (should-not (file-exists-p tmp-name))
2360 (write-region "foo" nil tmp-name)
2361 (should (file-exists-p tmp-name))
2362 (delete-file tmp-name 'trash)
2363 (should-not (file-exists-p tmp-name))
2364 (should-not
2365 (file-exists-p
2366 (expand-file-name (file-name-nondirectory tmp-name) trash-directory)))
2367 (delete-directory trash-directory 'recursive)
2368 (should-not (file-exists-p trash-directory))))))
2349 2369
2350(ert-deftest tramp-test08-file-local-copy () 2370(ert-deftest tramp-test08-file-local-copy ()
2351 "Check `file-local-copy'." 2371 "Check `file-local-copy'."
@@ -2953,7 +2973,23 @@ This tests also `file-directory-p' and `file-accessible-directory-p'."
2953 "%s/%s/%s/bla" trash-directory (file-name-nondirectory tmp-name1) 2973 "%s/%s/%s/bla" trash-directory (file-name-nondirectory tmp-name1)
2954 (file-name-nondirectory tmp-name2)))) 2974 (file-name-nondirectory tmp-name2))))
2955 (delete-directory trash-directory 'recursive) 2975 (delete-directory trash-directory 'recursive)
2956 (should-not (file-exists-p trash-directory))))))) 2976 (should-not (file-exists-p trash-directory))))
2977
2978 ;; Setting `remote-file-name-inhibit-delete-by-moving-to-trash'
2979 ;; prevents trashing remote files.
2980 (let ((trash-directory (tramp--test-make-temp-name 'local quoted))
2981 (delete-by-moving-to-trash t)
2982 (remote-file-name-inhibit-delete-by-moving-to-trash t))
2983 (make-directory trash-directory)
2984 (make-directory tmp-name1)
2985 (should (file-directory-p tmp-name1))
2986 (delete-directory tmp-name1 nil 'trash)
2987 (should-not (file-exists-p tmp-name1))
2988 (should-not
2989 (file-exists-p
2990 (expand-file-name (file-name-nondirectory tmp-name1) trash-directory)))
2991 (delete-directory trash-directory 'recursive)
2992 (should-not (file-exists-p trash-directory))))))
2957 2993
2958(ert-deftest tramp-test15-copy-directory () 2994(ert-deftest tramp-test15-copy-directory ()
2959 "Check `copy-directory'." 2995 "Check `copy-directory'."
@@ -7518,6 +7554,8 @@ Since it unloads Tramp, it shall be the last test to run."
7518 ;; `tramp-register-archive-file-name-handler' is autoloaded 7554 ;; `tramp-register-archive-file-name-handler' is autoloaded
7519 ;; in Emacs < 29.1. 7555 ;; in Emacs < 29.1.
7520 (not (eq 'tramp-register-archive-file-name-handler x)) 7556 (not (eq 'tramp-register-archive-file-name-handler x))
7557 ;; `tramp-compat-rx' is autoloaded in Emacs 29.1.
7558 (not (eq 'tramp-compat-rx x))
7521 (not (string-match-p 7559 (not (string-match-p
7522 (rx bol "tramp" (? "-archive") (** 1 2 "-") "test") 7560 (rx bol "tramp" (? "-archive") (** 1 2 "-") "test")
7523 (symbol-name x))) 7561 (symbol-name x)))
@@ -7577,6 +7615,8 @@ If INTERACTIVE is non-nil, the tests are run interactively."
7577;; * file-equal-p (partly done in `tramp-test21-file-links') 7615;; * file-equal-p (partly done in `tramp-test21-file-links')
7578;; * file-in-directory-p 7616;; * file-in-directory-p
7579;; * file-name-case-insensitive-p 7617;; * file-name-case-insensitive-p
7618;; * memory-info
7619;; * tramp-get-home-directory
7580;; * tramp-get-remote-gid 7620;; * tramp-get-remote-gid
7581;; * tramp-get-remote-groups 7621;; * tramp-get-remote-groups
7582;; * tramp-get-remote-uid 7622;; * tramp-get-remote-uid
diff --git a/test/lisp/progmodes/python-tests.el b/test/lisp/progmodes/python-tests.el
index eac558db10f..df71990278e 100644
--- a/test/lisp/progmodes/python-tests.el
+++ b/test/lisp/progmodes/python-tests.el
@@ -4520,6 +4520,16 @@ def foo():
4520 (python-tests-look-at "\"\"\"")) 4520 (python-tests-look-at "\"\"\""))
4521 "# -*- coding: utf-8 -*-\n\nif True:\n a = 1\n b = 2\n\n")))) 4521 "# -*- coding: utf-8 -*-\n\nif True:\n a = 1\n b = 2\n\n"))))
4522 4522
4523(ert-deftest python-shell-buffer-substring-18 ()
4524 "Check substring from the part of the first line."
4525 (python-tests-with-temp-buffer
4526 "s = 'test'
4527"
4528 (should (string= (python-shell-buffer-substring
4529 (python-tests-look-at "'test'")
4530 (pos-eol))
4531 "'test'"))))
4532
4523 4533
4524 4534
4525;;; Shell completion 4535;;; Shell completion
diff --git a/test/lisp/progmodes/ruby-mode-resources/ruby.rb b/test/lisp/progmodes/ruby-mode-resources/ruby.rb
index bfae948b259..3f0dfdf68ba 100644
--- a/test/lisp/progmodes/ruby-mode-resources/ruby.rb
+++ b/test/lisp/progmodes/ruby-mode-resources/ruby.rb
@@ -513,7 +513,7 @@ foo bar, {
513case translation 513case translation
514in ['th', orig_text, 'en', trans_text] 514in ['th', orig_text, 'en', trans_text]
515 puts "English translation: #{orig_text} => #{trans_text}" 515 puts "English translation: #{orig_text} => #{trans_text}"
516in {'th' => orig_text, 'ja' => trans_text} 516in {th: orig_text, ja: trans_text} => whole
517 puts "Japanese translation: #{orig_text} => #{trans_text}" 517 puts "Japanese translation: #{orig_text} => #{trans_text}"
518end 518end
519 519