aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/lisp/auth-source-pass-tests.el5
-rw-r--r--test/lisp/cus-edit-tests.el2
-rw-r--r--test/lisp/dired-tests.el150
-rw-r--r--test/lisp/erc/erc-track-tests.el27
-rw-r--r--test/lisp/files-tests.el18
-rw-r--r--test/lisp/gnus/gnus-icalendar-tests.el82
-rw-r--r--test/lisp/net/tramp-tests.el39
-rw-r--r--test/lisp/progmodes/python-tests.el4
-rw-r--r--test/lisp/ses-tests.el109
-rw-r--r--test/lisp/subr-tests.el46
-rw-r--r--test/lisp/xt-mouse-tests.el3
-rw-r--r--test/src/terminal-tests.el55
12 files changed, 455 insertions, 85 deletions
diff --git a/test/lisp/auth-source-pass-tests.el b/test/lisp/auth-source-pass-tests.el
index 15fd9ed7007..2afd803240e 100644
--- a/test/lisp/auth-source-pass-tests.el
+++ b/test/lisp/auth-source-pass-tests.el
@@ -91,7 +91,10 @@ This function is intended to be set to `auth-source-debug'."
91 ((symbol-function 'auth-source-pass-entries) (lambda () (mapcar #'car ,store)))) 91 ((symbol-function 'auth-source-pass-entries) (lambda () (mapcar #'car ,store))))
92 (let ((auth-source-debug #'auth-source-pass--debug) 92 (let ((auth-source-debug #'auth-source-pass--debug)
93 (auth-source-pass--debug-log nil) 93 (auth-source-pass--debug-log nil)
94 (auth-source-pass--parse-log nil)) 94 (auth-source-pass--parse-log nil)
95 ;; Any existing directory will do, since we shouldn't do I/O
96 ;; except for the guard in `auth-source-pass-search'.
97 (auth-source-pass-filename default-directory))
95 ,@body))) 98 ,@body)))
96 99
97(defun auth-source-pass--explain-match-entry-p (entry hostname &optional user port) 100(defun auth-source-pass--explain-match-entry-p (entry hostname &optional user port)
diff --git a/test/lisp/cus-edit-tests.el b/test/lisp/cus-edit-tests.el
index 67a377e9073..770a1549c56 100644
--- a/test/lisp/cus-edit-tests.el
+++ b/test/lisp/cus-edit-tests.el
@@ -90,7 +90,7 @@
90 (erase-buffer)) 90 (erase-buffer))
91 (setopt cus-edit-test-foo1 :foo) 91 (setopt cus-edit-test-foo1 :foo)
92 (buffer-substring-no-properties (point-min) (point-max))))) 92 (buffer-substring-no-properties (point-min) (point-max)))))
93 (should (string-search "Value `:foo' for variable `cus-edit-test-foo1' does not match its type \"number\"" 93 (should (string-search "Value does not match cus-edit-test-foo1's type `number': :foo\n"
94 warn-txt)))) 94 warn-txt))))
95 95
96(defcustom cus-edit-test-bug63290-option nil 96(defcustom cus-edit-test-bug63290-option nil
diff --git a/test/lisp/dired-tests.el b/test/lisp/dired-tests.el
index 7d0ea1692ff..77ed07fcc42 100644
--- a/test/lisp/dired-tests.el
+++ b/test/lisp/dired-tests.el
@@ -658,5 +658,155 @@ The current directory at call time should not affect the result (Bug#50630)."
658 (let ((default-directory test-dir-other)) 658 (let ((default-directory test-dir-other))
659 (files-tests--insert-directory-shows-given-free test-dir))))) 659 (files-tests--insert-directory-shows-given-free test-dir)))))
660 660
661(ert-deftest dired-test-filename-with-newline-1 () ; bug#79528, bug#80499
662 "Test handling of file name with literal embedded newline."
663 ;; File names with embedded newlines are not allowed on MS-Windows and
664 ;; MS-DOS.
665 (skip-when (memq system-type '(windows-nt ms-dos)))
666 (with-current-buffer "*Messages*"
667 (let ((inhibit-read-only t))
668 (erase-buffer)))
669 (let* ((dired-auto-toggle-b-switch nil)
670 (dir (ert-resource-file
671 (file-name-as-directory "filename-with-newline")))
672 (file (concat dir "filename\nwith newline"))
673 (buf (progn (make-empty-file file t)
674 (dired (file-name-directory file))))
675 (warnbuf (get-buffer "*Warnings*")))
676 (should (dired--filename-with-newline-p))
677 (let ((beg (point)) ; beginning of file name
678 (_ (dired-move-to-end-of-filename)))
679 (should (search-backward "with newline")) ; literal space in file name
680 (should (search-backward "\n" beg))) ; literal newline in file name
681 (if noninteractive
682 (with-current-buffer "*Messages*"
683 (goto-char (point-min))
684 (should (search-forward
685 "Warning (dired): Literal newline in file name.")))
686 (should (get-buffer-window warnbuf))
687 (with-current-buffer warnbuf
688 (goto-char (point-min))
689 (should (string-match
690 (regexp-quote "Warning (dired): Literal newline in file name.")
691 (buffer-substring (pos-bol) (pos-eol))))))
692 (kill-buffer buf)
693 (kill-buffer warnbuf)
694 (delete-directory dir t)))
695
696(ert-deftest dired-test-filename-with-newline-2 () ; bug#79528, bug#80499
697 "Test handling of file name with embedded newline using `b' switch."
698 ;; File names with embedded newlines are not allowed on MS-Windows and
699 ;; MS-DOS.
700 (skip-when (memq system-type '(windows-nt ms-dos)))
701 (with-current-buffer "*Messages*"
702 (let ((inhibit-read-only t))
703 (erase-buffer)))
704 (let* ((dired-auto-toggle-b-switch t)
705 (dir (ert-resource-file
706 (file-name-as-directory "filename-with-newline")))
707 (file (concat dir "filename\nwith newline"))
708 (buf (progn (make-empty-file file t)
709 (dired-noselect (file-name-directory file))))
710 (warnbuf (get-buffer "*Warnings*")))
711 (with-current-buffer buf
712 (should (dired--filename-with-newline-p))
713 (dired--toggle-b-switch)
714 (let ((beg (point)) ; beginning of file name
715 (_ (dired-move-to-end-of-filename)))
716 (should (search-backward "with\\ newline")) ; result of ls -b switch
717 (should (search-backward "\\n" beg)))) ; result of ls -b switch
718 (if noninteractive
719 (with-current-buffer "*Messages*"
720 (goto-char (point-min))
721 (should-error (search-forward
722 "Warning (dired): Literal newline in file name.")))
723 (should-not (get-buffer "*Warnings*")))
724 (kill-buffer buf)
725 (kill-buffer warnbuf)
726 (delete-directory dir t)))
727
728(ert-deftest dired-test-ls-error-message () ; bug#80499
729 "Test invoking `dired' on a nonexisting file.
730A buffer should pop up containing the error emitted by ls. The buffer
731visiting the nonexisting file should killed before `dired' returns,
732hence another buffer should be returned."
733 (let* ((dir (ert-resource-file (file-name-as-directory "empty-dir")))
734 (name (concat dir "bla"))
735 ;; Use PARENT = t in make-directory call to avoid failing if
736 ;; the directyory already exists for some reason.
737 (buf (progn (make-directory dir t)
738 (dired name))))
739 ;; This is for MS-Windows and MS-DOS in the default configuration.
740 (when (and (featurep 'ls-lisp)
741 (boundp 'ls-lisp-use-insert-directory-program)
742 (null ls-lisp-use-insert-directory-program))
743 (should (bufferp buf))
744 (should (equal (buffer-name buf) (file-name-nondirectory name)))
745 (with-current-buffer buf
746 ;; 'ls-lisp' creates a Dired buffer of just 3 lines, with
747 ;; "(No match)" on the last line
748 (should (string-match "(No match)" (buffer-string)))
749 (should (= 3 (line-number-at-pos (buffer-size) t)))))
750 ;; This is for Posix systems and for MS-Windows/DOS when they use 'ls'.
751 (unless (and (featurep 'ls-lisp)
752 (boundp 'ls-lisp-use-insert-directory-program)
753 (null ls-lisp-use-insert-directory-program))
754 (let ((errbuf (get-buffer "*ls error*")))
755 (should (get-buffer-window errbuf))
756 (should-not (equal (buffer-name buf) (file-name-nondirectory name)))
757 (with-current-buffer errbuf
758 (should (string-match-p
759 (format
760 ;; Use .* around file name to account for different
761 ;; file-name quoting styles, or no quoting at all.
762 "%s: cannot access .*%s.*: No such file or directory\n"
763 insert-directory-program (file-name-nondirectory name))
764 (buffer-string))))
765 (kill-buffer errbuf))
766 (delete-directory dir t))))
767
768
769(defun dired-test--filename-with-backslash-n ()
770 "Core of test `dired-test-filename-with-backslash-n'."
771 (let* ((dir (ert-resource-file
772 (file-name-as-directory "filename-with-backslash")))
773 (file (concat dir "C:\\nppdf32log\\debuglog.txt"))
774 (buf (progn (make-empty-file file t)
775 (dired-noselect (file-name-directory file))))
776 (warnbuf (get-buffer "*Warnings*")))
777 (with-current-buffer buf
778 (should-not (dired--filename-with-newline-p))
779 (dired--toggle-b-switch)
780 (should-not (dired--filename-with-newline-p))
781 (let ((fn (car (directory-files dir t
782 directory-files-no-dot-files-regexp))))
783 (should (equal fn file))))
784 (if noninteractive
785 (with-current-buffer "*Messages*"
786 (goto-char (point-min))
787 (should-error (search-forward
788 "Warning (dired): Literal newline in file name.")))
789 (should-not (get-buffer "*Warnings*")))
790 (kill-buffer buf)
791 (kill-buffer warnbuf)
792 (delete-directory dir t)))
793
794(ert-deftest dired-test-filename-with-backslash-n () ; bug#80608
795 "Test file name containing literal backslash-n sequence.
796Dired should not treat this sequence as a newline character, regardless
797of the value of `dired-auto-toggle-b-switch'."
798 ;; File names with backslashes in basename are not allowed on MS systems.
799 (skip-when (memq system-type '(windows-nt ms-dos)))
800 (with-current-buffer "*Messages*"
801 (let ((inhibit-read-only t))
802 (erase-buffer)))
803 (let ((dired-auto-toggle-b-switch nil))
804 (dired-test--filename-with-backslash-n))
805 (with-current-buffer "*Messages*"
806 (let ((inhibit-read-only t))
807 (erase-buffer)))
808 (let ((dired-auto-toggle-b-switch nil))
809 (dired-test--filename-with-backslash-n)))
810
661(provide 'dired-tests) 811(provide 'dired-tests)
662;;; dired-tests.el ends here 812;;; dired-tests.el ends here
diff --git a/test/lisp/erc/erc-track-tests.el b/test/lisp/erc/erc-track-tests.el
index da4a4d0fad7..cce28360eff 100644
--- a/test/lisp/erc/erc-track-tests.el
+++ b/test/lisp/erc/erc-track-tests.el
@@ -478,12 +478,28 @@
478 (funcall set-faces '(erc-notice-face)) 478 (funcall set-faces '(erc-notice-face))
479 (erc-track-modified-channels) 479 (erc-track-modified-channels)
480 (should (equal (alist-get (current-buffer) erc-modified-channels-alist) 480 (should (equal (alist-get (current-buffer) erc-modified-channels-alist)
481 '(5 . erc-notice-face)))) 481 (if (gethash 'erc-notice-face erc-track--normal-faces)
482 '(5 . erc-notice-face)
483 '(5 erc-button-nick-default-face erc-nick-default-face)))))
482 484
483(ert-deftest erc-track-modified-channels/baseline () 485(ert-deftest erc-track-modified-channels/baseline ()
484 (erc-tests-common-track-modified-channels 486 (erc-tests-common-track-modified-channels
485 #'erc-track-tests--modified-channels/baseline)) 487 #'erc-track-tests--modified-channels/baseline))
486 488
489;; This "baseline" variant simulates `erc-notice-face' being absent from
490;; `erc-track-faces-normal-list' by removing it from the cached local
491;; copy in `erc-track--normal-faces'. When absent and a message
492;; highlighted in `erc-notice-face' is inserted, the mode line should
493;; not change if it's currently showing a face ranked higher in
494;; `erc-track-faces-priority-list'. ERC 5.6 and 5.6.1 featured a
495;; regression that caused the mode line to keep alternating regardless.
496;; See Bug#80659: erc: Faces not being updated correctly.
497(ert-deftest erc-track-modified-channels/baseline/nonotice ()
498 (erc-tests-common-track-modified-channels
499 (lambda (set-faces)
500 (remhash 'erc-notice-face erc-track--normal-faces)
501 (funcall #'erc-track-tests--modified-channels/baseline set-faces))))
502
487(ert-deftest erc-track-modified-channels/baseline/mention () 503(ert-deftest erc-track-modified-channels/baseline/mention ()
488 (erc-tests-common-track-modified-channels 504 (erc-tests-common-track-modified-channels
489 (lambda (set-faces) 505 (lambda (set-faces)
@@ -613,6 +629,15 @@
613 (erc-tests-common-track-modified-channels 629 (erc-tests-common-track-modified-channels
614 #'erc-track-tests--modified-channels/baseline))) 630 #'erc-track-tests--modified-channels/baseline)))
615 631
632;; Option `erc-track-priority-faces-only' does not affect Bug#80659 (see
633;; baseline test without the option above).
634(ert-deftest erc-track-modified-channels/priority-only-all/baseline/nonotice ()
635 (let ((erc-track-priority-faces-only 'all))
636 (erc-tests-common-track-modified-channels
637 (lambda (set-faces)
638 (remhash 'erc-notice-face erc-track--normal-faces)
639 (funcall #'erc-track-tests--modified-channels/baseline set-faces)))))
640
616;; This test simulates a common configuration that combines an 641;; This test simulates a common configuration that combines an
617;; `erc-track-faces-priority-list' removed of `erc-notice-face' with 642;; `erc-track-faces-priority-list' removed of `erc-notice-face' with
618;; `erc-track-priority-faces-only' being `all'. It also features in the 643;; `erc-track-priority-faces-only' being `all'. It also features in the
diff --git a/test/lisp/files-tests.el b/test/lisp/files-tests.el
index e6b2a0eb078..6781c4a3d8b 100644
--- a/test/lisp/files-tests.el
+++ b/test/lisp/files-tests.el
@@ -1027,7 +1027,23 @@ unquoted file names."
1027 (buffer-string))))) 1027 (buffer-string)))))
1028 (files-tests--with-temp-non-special-and-file-name-handler 1028 (files-tests--with-temp-non-special-and-file-name-handler
1029 (tmpdir nospecial-dir t) 1029 (tmpdir nospecial-dir t)
1030 (should-error (with-temp-buffer (insert-directory nospecial-dir ""))))) 1030 (if (memq system-type '(windows-nt ms-dos))
1031 (should-error (with-temp-buffer (insert-directory nospecial-dir "")))
1032 (with-temp-buffer (insert-directory nospecial-dir ""))
1033 (let ((errbuf (get-buffer "*ls error*"))
1034 ;; By the time `ls' is called in `insert-directory', the
1035 ;; handler prefix has been removed.
1036 (nospecial-dir (string-remove-prefix "/:" nospecial-dir)))
1037 (should errbuf)
1038 (with-current-buffer errbuf
1039 (should (string-match-p
1040 (format
1041 ;; Use .* around file name to account for different
1042 ;; file-name quoting styles, or no quoting at all.
1043 "%s: cannot access .*%s.*: No such file or directory\n"
1044 insert-directory-program nospecial-dir)
1045 (buffer-string))))
1046 (kill-buffer errbuf)))))
1031 1047
1032(ert-deftest files-tests-file-name-non-special-insert-file-contents () 1048(ert-deftest files-tests-file-name-non-special-insert-file-contents ()
1033 (files-tests--with-temp-non-special (tmpfile nospecial) 1049 (files-tests--with-temp-non-special (tmpfile nospecial)
diff --git a/test/lisp/gnus/gnus-icalendar-tests.el b/test/lisp/gnus/gnus-icalendar-tests.el
index df9358b96c5..e668becd54d 100644
--- a/test/lisp/gnus/gnus-icalendar-tests.el
+++ b/test/lisp/gnus/gnus-icalendar-tests.el
@@ -35,7 +35,7 @@
35 (let (event) 35 (let (event)
36 (with-temp-buffer 36 (with-temp-buffer
37 (insert ical-string) 37 (insert ical-string)
38 (setq event (gnus-icalendar-event-from-buffer (buffer-name) participant))) 38 (setq event (gnus-icalendar-event-from-buffer (current-buffer) participant)))
39 event)) 39 event))
40 40
41(ert-deftest gnus-icalendar-parse () 41(ert-deftest gnus-icalendar-parse ()
@@ -94,7 +94,8 @@ END:VCALENDAR
94 (setenv "TZ" "CET-1CEST,M3.5.0/2,M10.5.0/3") 94 (setenv "TZ" "CET-1CEST,M3.5.0/2,M10.5.0/3")
95 (should (eq (eieio-object-class event) 'gnus-icalendar-event-request)) 95 (should (eq (eieio-object-class event) 'gnus-icalendar-event-request))
96 (should (not (gnus-icalendar-event:recurring-p event))) 96 (should (not (gnus-icalendar-event:recurring-p event)))
97 (should (string= (gnus-icalendar-event:start event) "2020-12-08 15:00")) 97 (should (equal (gnus-icalendar-event:start event)
98 "2020-12-08 15:00"))
98 (with-slots (organizer summary description location end-time uid rsvp participation-type) event 99 (with-slots (organizer summary description location end-time uid rsvp participation-type) event
99 (should (string= organizer "anoncompany.com_3bm6fh805bme9uoeliqcle1sag@group.calendar.google.com")) 100 (should (string= organizer "anoncompany.com_3bm6fh805bme9uoeliqcle1sag@group.calendar.google.com"))
100 (should (string= summary "Townhall | All Company Meeting")) 101 (should (string= summary "Townhall | All Company Meeting"))
@@ -106,9 +107,20 @@ END:VCALENDAR
106 (should (eq participation-type 'non-participant)))) 107 (should (eq participation-type 'non-participant))))
107 (setenv "TZ" tz)))) 108 (setenv "TZ" tz))))
108 109
110(defun gnus-icalendar-at/@ ()
111 "Replace \" <at> \" with \"@\" before parsing."
112 (goto-char (point-min))
113 (while (re-search-forward " <at> " nil t)
114 (replace-match "@")))
115
116;; FIXME: is "icalendary" (not "icalendar") intentional, here and below?
109(ert-deftest gnus-icalendary-byday () 117(ert-deftest gnus-icalendary-byday ()
110 "" 118 ""
111 (let ((tz (getenv "TZ")) 119 (let* ((tz (getenv "TZ"))
120 (icalendar-pre-parsing-hook
121 ;; clean up " <at> " addresses so the parser doesn't choke...
122 ;; FIXME: can we just change the test data, or is this a real example?
123 '(gnus-icalendar-at/@))
112 (event (gnus-icalendar-tests--get-ical-event "\ 124 (event (gnus-icalendar-tests--get-ical-event "\
113BEGIN:VCALENDAR 125BEGIN:VCALENDAR
114PRODID:Zimbra-Calendar-Provider 126PRODID:Zimbra-Calendar-Provider
@@ -138,8 +150,8 @@ SUMMARY:appointment every weekday\\, start jul 24\\, 2020\\, end aug 24\\, 2020
138ATTENDEE;CN=Mark Hershberger;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP 150ATTENDEE;CN=Mark Hershberger;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP
139 =TRUE:mailto:hexmode <at> gmail.com 151 =TRUE:mailto:hexmode <at> gmail.com
140ORGANIZER;CN=Mark A. Hershberger:mailto:mah <at> nichework.com 152ORGANIZER;CN=Mark A. Hershberger:mailto:mah <at> nichework.com
141DTSTART;TZID=\"America/New_York\":20200724T090000 153DTSTART;TZID=America/New_York:20200724T090000
142DTEND;TZID=\"America/New_York\":20200724T093000 154DTEND;TZID=America/New_York:20200724T093000
143STATUS:CONFIRMED 155STATUS:CONFIRMED
144CLASS:PUBLIC 156CLASS:PUBLIC
145X-MICROSOFT-CDO-INTENDEDSTATUS:BUSY 157X-MICROSOFT-CDO-INTENDEDSTATUS:BUSY
@@ -163,10 +175,12 @@ END:VCALENDAR" (list "Mark Hershberger"))))
163 (setenv "TZ" "CET-1CEST,M3.5.0/2,M10.5.0/3") 175 (setenv "TZ" "CET-1CEST,M3.5.0/2,M10.5.0/3")
164 (should (eq (eieio-object-class event) 'gnus-icalendar-event-request)) 176 (should (eq (eieio-object-class event) 'gnus-icalendar-event-request))
165 (should (gnus-icalendar-event:recurring-p event)) 177 (should (gnus-icalendar-event:recurring-p event))
166 (should (string= (gnus-icalendar-event:recurring-interval event) "1")) 178 (should (= 1 (gnus-icalendar-event:recurring-interval event)))
167 (should (string= (gnus-icalendar-event:start event) "2020-07-24 15:00")) 179 (should (string= (gnus-icalendar-event:start event) "2020-07-24 15:00"))
168 (with-slots (organizer summary description location end-time uid rsvp participation-type) event 180 (with-slots (organizer summary description location end-time uid rsvp participation-type) event
169 (should (string= organizer "mah <at> nichework.com")) 181 (should (string= organizer
182 (replace-regexp-in-string " <at> " "@"
183 "mah <at> nichework.com")))
170 (should (string= summary "appointment every weekday, start jul 24, 2020, end aug 24, 2020")) 184 (should (string= summary "appointment every weekday, start jul 24, 2020, end aug 24, 2020"))
171 (should (string= description "The following is a new meeting request:")) 185 (should (string= description "The following is a new meeting request:"))
172 (should (null location)) 186 (should (null location))
@@ -236,7 +250,7 @@ END:VCALENDAR" (list "participant@anoncompany.com"))))
236 (setenv "TZ" "CET-1CEST,M3.5.0/2,M10.5.0/3") 250 (setenv "TZ" "CET-1CEST,M3.5.0/2,M10.5.0/3")
237 (should (eq (eieio-object-class event) 'gnus-icalendar-event-request)) 251 (should (eq (eieio-object-class event) 'gnus-icalendar-event-request))
238 (should (gnus-icalendar-event:recurring-p event)) 252 (should (gnus-icalendar-event:recurring-p event))
239 (should (string= (gnus-icalendar-event:recurring-interval event) "1")) 253 (should (= 1 (gnus-icalendar-event:recurring-interval event)))
240 (should (string= (gnus-icalendar-event:start event) "2020-09-15 14:00")) 254 (should (string= (gnus-icalendar-event:start event) "2020-09-15 14:00"))
241 (with-slots (organizer summary description location end-time uid rsvp participation-type) event 255 (with-slots (organizer summary description location end-time uid rsvp participation-type) event
242 (should (string= organizer "anon@anoncompany.com")) 256 (should (string= organizer "anon@anoncompany.com"))
@@ -258,6 +272,29 @@ END:VCALENDAR" (list "participant@anoncompany.com"))))
258(ert-deftest gnus-icalendar-accept-with-comment () 272(ert-deftest gnus-icalendar-accept-with-comment ()
259 "" 273 ""
260 (let ((event "\ 274 (let ((event "\
275BEGIN:VCALENDAR
276PRODID:-//Google Inc//Google Calendar 70.9054//EN
277VERSION:2.0
278CALSCALE:GREGORIAN
279METHOD:REQUEST
280BEGIN:VTIMEZONE
281TZID:Europe/Berlin
282X-LIC-LOCATION:Europe/Berlin
283BEGIN:DAYLIGHT
284TZOFFSETFROM:+0100
285TZOFFSETTO:+0200
286TZNAME:CEST
287DTSTART:19700329T020000
288RRULE:FREQ=YEARLY;BYMONTH=3;BYDAY=-1SU
289END:DAYLIGHT
290BEGIN:STANDARD
291TZOFFSETFROM:+0200
292TZOFFSETTO:+0100
293TZNAME:CET
294DTSTART:19701025T030000
295RRULE:FREQ=YEARLY;BYMONTH=10;BYDAY=-1SU
296END:STANDARD
297END:VTIMEZONE
261BEGIN:VEVENT 298BEGIN:VEVENT
262DTSTART;TZID=Europe/Berlin:20200915T140000 299DTSTART;TZID=Europe/Berlin:20200915T140000
263DTEND;TZID=Europe/Berlin:20200915T143000 300DTEND;TZID=Europe/Berlin:20200915T143000
@@ -275,7 +312,8 @@ SEQUENCE:0
275STATUS:CONFIRMED 312STATUS:CONFIRMED
276SUMMARY:Casual coffee talk 313SUMMARY:Casual coffee talk
277TRANSP:OPAQUE 314TRANSP:OPAQUE
278END:VEVENT") 315END:VEVENT
316END:VCALENDAR")
279 (icalendar-identities '("participant@anoncompany.com"))) 317 (icalendar-identities '("participant@anoncompany.com")))
280 (let* ((reply (with-temp-buffer 318 (let* ((reply (with-temp-buffer
281 (insert event) 319 (insert event)
@@ -292,6 +330,29 @@ END:VEVENT")
292(ert-deftest gnus-icalendar-decline-without-changing-comment () 330(ert-deftest gnus-icalendar-decline-without-changing-comment ()
293 "" 331 ""
294 (let ((event "\ 332 (let ((event "\
333BEGIN:VCALENDAR
334PRODID:-//Google Inc//Google Calendar 70.9054//EN
335VERSION:2.0
336CALSCALE:GREGORIAN
337METHOD:REQUEST
338BEGIN:VTIMEZONE
339TZID:Europe/Berlin
340X-LIC-LOCATION:Europe/Berlin
341BEGIN:DAYLIGHT
342TZOFFSETFROM:+0100
343TZOFFSETTO:+0200
344TZNAME:CEST
345DTSTART:19700329T020000
346RRULE:FREQ=YEARLY;BYMONTH=3;BYDAY=-1SU
347END:DAYLIGHT
348BEGIN:STANDARD
349TZOFFSETFROM:+0200
350TZOFFSETTO:+0100
351TZNAME:CET
352DTSTART:19701025T030000
353RRULE:FREQ=YEARLY;BYMONTH=10;BYDAY=-1SU
354END:STANDARD
355END:VTIMEZONE
295BEGIN:VEVENT 356BEGIN:VEVENT
296DTSTART;TZID=Europe/Berlin:20200915T140000 357DTSTART;TZID=Europe/Berlin:20200915T140000
297DTEND;TZID=Europe/Berlin:20200915T143000 358DTEND;TZID=Europe/Berlin:20200915T143000
@@ -310,7 +371,8 @@ SEQUENCE:0
310STATUS:CONFIRMED 371STATUS:CONFIRMED
311SUMMARY:Casual coffee talk 372SUMMARY:Casual coffee talk
312TRANSP:OPAQUE 373TRANSP:OPAQUE
313END:VEVENT") 374END:VEVENT
375END:VCALENDAR")
314 (icalendar-identities '("participant@anoncompany.com"))) 376 (icalendar-identities '("participant@anoncompany.com")))
315 (let* ((reply (with-temp-buffer 377 (let* ((reply (with-temp-buffer
316 (insert event) 378 (insert event)
diff --git a/test/lisp/net/tramp-tests.el b/test/lisp/net/tramp-tests.el
index 149fa1d2537..3972e5faa45 100644
--- a/test/lisp/net/tramp-tests.el
+++ b/test/lisp/net/tramp-tests.el
@@ -5078,6 +5078,21 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'."
5078 (sort (file-name-all-completions "b" tmp-name) #'string-lessp) 5078 (sort (file-name-all-completions "b" tmp-name) #'string-lessp)
5079 '("bold" "boz/"))) 5079 '("bold" "boz/")))
5080 (should-not (file-name-all-completions "a" tmp-name)) 5080 (should-not (file-name-all-completions "a" tmp-name))
5081 ;; Symbolic links.
5082 (tramp--test-ignore-make-symbolic-link-error
5083 (make-symbolic-link
5084 (file-name-concat tmp-name "foo")
5085 (file-name-concat tmp-name "link1"))
5086 (should (file-exists-p (expand-file-name "link1" tmp-name)))
5087 (make-symbolic-link
5088 (file-name-concat tmp-name "boz")
5089 (file-name-concat tmp-name "link2"))
5090 (should (file-exists-p (expand-file-name "link2" tmp-name)))
5091 (should (equal (file-name-completion "li" tmp-name) "link"))
5092 (should (member "link1" (file-name-all-completions "" tmp-name)))
5093 (should (member "link2/" (file-name-all-completions "" tmp-name)))
5094 (delete-file (file-name-concat tmp-name "link1"))
5095 (delete-file (file-name-concat tmp-name "link2")))
5081 ;; `completion-regexp-list' restricts the completion to 5096 ;; `completion-regexp-list' restricts the completion to
5082 ;; files which match all expressions in this list. 5097 ;; files which match all expressions in this list.
5083 ;; Ange-FTP does not complete "". 5098 ;; Ange-FTP does not complete "".
@@ -6329,9 +6344,12 @@ INPUT, if non-nil, is a string sent to the process."
6329 this-shell-command 6344 this-shell-command
6330 "echo foo >&2; echo bar" (current-buffer) stderr) 6345 "echo foo >&2; echo bar" (current-buffer) stderr)
6331 (should (string-equal "bar\n" (buffer-string))) 6346 (should (string-equal "bar\n" (buffer-string)))
6332 ;; Check stderr. 6347 ;; Check stderr. Some shells echo, for example the
6348 ;; "adb" or container methods.
6333 (should 6349 (should
6334 (string-equal "foo\n" (tramp-get-buffer-string stderr)))) 6350 (string-match-p
6351 (rx bol (** 1 2 "foo\n") eol)
6352 (tramp-get-buffer-string stderr))))
6335 6353
6336 ;; Cleanup. 6354 ;; Cleanup.
6337 (ignore-errors (kill-buffer stderr)))))) 6355 (ignore-errors (kill-buffer stderr))))))
@@ -6896,8 +6914,7 @@ INPUT, if non-nil, is a string sent to the process."
6896 "Check `vc-registered'." 6914 "Check `vc-registered'."
6897 :tags '(:expensive-test) 6915 :tags '(:expensive-test)
6898 (skip-unless (tramp--test-enabled)) 6916 (skip-unless (tramp--test-enabled))
6899 (skip-unless (tramp--test-sh-p)) 6917 (skip-unless (tramp--test-supports-processes-p))
6900 (skip-unless (not (tramp--test-crypt-p)))
6901 6918
6902 (dolist (quoted (if (tramp--test-expensive-test-p) '(nil t) '(nil))) 6919 (dolist (quoted (if (tramp--test-expensive-test-p) '(nil t) '(nil)))
6903 ;; We must use `file-truename' for the temporary directory, in 6920 ;; We must use `file-truename' for the temporary directory, in
@@ -6912,17 +6929,9 @@ INPUT, if non-nil, is a string sent to the process."
6912 (inhibit-message (not (ignore-errors (edebug-mode)))) 6929 (inhibit-message (not (ignore-errors (edebug-mode))))
6913 (vc-handled-backends 6930 (vc-handled-backends
6914 (cond 6931 (cond
6915 ((tramp-find-executable 6932 ((executable-find vc-git-program 'remote) '(Git))
6916 tramp-test-vec vc-git-program 6933 ((executable-find vc-hg-program 'remote) '(Hg))
6917 (tramp-get-remote-path tramp-test-vec)) 6934 ((executable-find vc-bzr-program 'remote)
6918 '(Git))
6919 ((tramp-find-executable
6920 tramp-test-vec vc-hg-program
6921 (tramp-get-remote-path tramp-test-vec))
6922 '(Hg))
6923 ((tramp-find-executable
6924 tramp-test-vec vc-bzr-program
6925 (tramp-get-remote-path tramp-test-vec))
6926 (setq tramp-remote-process-environment 6935 (setq tramp-remote-process-environment
6927 (cons (format "BZR_HOME=%s" 6936 (cons (format "BZR_HOME=%s"
6928 (file-remote-p tmp-name1 'localname)) 6937 (file-remote-p tmp-name1 'localname))
diff --git a/test/lisp/progmodes/python-tests.el b/test/lisp/progmodes/python-tests.el
index 1c625d79ca2..4d9e468bee1 100644
--- a/test/lisp/progmodes/python-tests.el
+++ b/test/lisp/progmodes/python-tests.el
@@ -8012,6 +8012,7 @@ always located at the beginning of buffer."
8012 def test():" 8012 def test():"
8013 8013
8014 (setopt treesit-font-lock-level 4) 8014 (setopt treesit-font-lock-level 4)
8015 (font-lock-ensure)
8015 (dolist (test '("pytest" "mark" "skip")) 8016 (dolist (test '("pytest" "mark" "skip"))
8016 (search-forward test) 8017 (search-forward test)
8017 (goto-char (match-beginning 0)) 8018 (goto-char (match-beginning 0))
@@ -8022,6 +8023,7 @@ always located at the beginning of buffer."
8022 "all()" 8023 "all()"
8023 ;; enable 'function' feature from 4th level 8024 ;; enable 'function' feature from 4th level
8024 (setopt treesit-font-lock-level 4) 8025 (setopt treesit-font-lock-level 4)
8026 (font-lock-ensure)
8025 (should (eq (face-at-point) 'font-lock-builtin-face)))) 8027 (should (eq (face-at-point) 'font-lock-builtin-face))))
8026 8028
8027(ert-deftest python-ts-mode-interpolation-nested-string () 8029(ert-deftest python-ts-mode-interpolation-nested-string ()
@@ -8050,6 +8052,7 @@ always located at the beginning of buffer."
8050 "t = f\"beg {True + var}\"" 8052 "t = f\"beg {True + var}\""
8051 8053
8052 (setopt treesit-font-lock-level 2) 8054 (setopt treesit-font-lock-level 2)
8055 (font-lock-ensure)
8053 (search-forward "f") 8056 (search-forward "f")
8054 (goto-char (match-beginning 0)) 8057 (goto-char (match-beginning 0))
8055 (should (not (eq (face-at-point) 'font-lock-string-face))) 8058 (should (not (eq (face-at-point) 'font-lock-string-face)))
@@ -8068,6 +8071,7 @@ always located at the beginning of buffer."
8068 (setf (nth 2 treesit-font-lock-feature-list) 8071 (setf (nth 2 treesit-font-lock-feature-list)
8069 (remq 'string-interpolation (nth 2 treesit-font-lock-feature-list))) 8072 (remq 'string-interpolation (nth 2 treesit-font-lock-feature-list)))
8070 (setopt treesit-font-lock-level 3) 8073 (setopt treesit-font-lock-level 3)
8074 (font-lock-ensure)
8071 8075
8072 (search-forward "f") 8076 (search-forward "f")
8073 (goto-char (match-beginning 0)) 8077 (goto-char (match-beginning 0))
diff --git a/test/lisp/ses-tests.el b/test/lisp/ses-tests.el
index 73f7be3145d..c1afa197c64 100644
--- a/test/lisp/ses-tests.el
+++ b/test/lisp/ses-tests.el
@@ -41,6 +41,19 @@
41 (defvar B2) 41 (defvar B2)
42 (defvar ses--toto)) 42 (defvar ses--toto))
43 43
44;; Check no border effects
45;; ======================================================================
46(defun ses-tests-check-no-border-effect ()
47 (dolist (symb ses-localvars)
48 (when (consp symb) (setq symb (car symb)))
49 (when (string-match "\\`ses--" (symbol-name symb))
50 (should (null (boundp symb))))))
51
52(defun ses-tests-unbind-local-vars ()
53 (dolist (symb ses-localvars)
54 (when (consp symb) (setq symb (car symb)))
55 (when (string-match "\\`ses--" (symbol-name symb)) (makunbound symb))))
56
44;; PLAIN FORMULA TESTS 57;; PLAIN FORMULA TESTS
45;; ====================================================================== 58;; ======================================================================
46 59
@@ -48,24 +61,28 @@
48 "Check that setting A1 to 1 and A2 to (1+ A1), makes A2 value 61 "Check that setting A1 to 1 and A2 to (1+ A1), makes A2 value
49equal to 2. This is done with low level functions calls, not like 62equal to 2. This is done with low level functions calls, not like
50interactively." 63interactively."
64 (ses-tests-unbind-local-vars)
51 (let ((ses-initial-size '(2 . 1))) 65 (let ((ses-initial-size '(2 . 1)))
52 (with-temp-buffer 66 (with-temp-buffer
53 (ses-mode) 67 (ses-mode)
54 (dolist (c '((0 0 1) (1 0 (1+ A1)))) 68 (dolist (c '((0 0 1) (1 0 (1+ A1))))
55 (apply 'ses-cell-set-formula c) 69 (apply 'ses-cell-set-formula c)
56 (apply 'ses-calculate-cell (list (car c) (cadr c) nil))) 70 (apply 'ses-calculate-cell (list (car c) (cadr c) nil)))
57 (should (eq (bound-and-true-p A2) 2))))) 71 (should (eq (bound-and-true-p A2) 2))))
72 (ses-tests-check-no-border-effect))
58 73
59(ert-deftest ses-tests-plain-formula () 74(ert-deftest ses-tests-plain-formula ()
60 "Check that setting A1 to 1 and A2 to (1+ A1), makes A2 value 75 "Check that setting A1 to 1 and A2 to (1+ A1), makes A2 value
61equal to 2. This is done using interactive calls." 76equal to 2. This is done using interactive calls."
77 (ses-tests-unbind-local-vars)
62 (let ((ses-initial-size '(2 . 1))) 78 (let ((ses-initial-size '(2 . 1)))
63 (with-temp-buffer 79 (with-temp-buffer
64 (ses-mode) 80 (ses-mode)
65 (dolist (c '((0 0 1) (1 0 (1+ A1)))) 81 (dolist (c '((0 0 1) (1 0 (1+ A1))))
66 (apply 'funcall-interactively 'ses-edit-cell c)) 82 (apply 'funcall-interactively 'ses-edit-cell c))
67 (ses-command-hook) 83 (ses-command-hook)
68 (should (eq (bound-and-true-p A2) 2))))) 84 (should (eq (bound-and-true-p A2) 2))))
85 (ses-tests-check-no-border-effect))
69 86
70;; PLAIN CELL RENAMING TESTS 87;; PLAIN CELL RENAMING TESTS
71;; ====================================================================== 88;; ======================================================================
@@ -75,6 +92,7 @@ equal to 2. This is done using interactive calls."
75This is done using low level functions, `ses-rename-cell' is not 92This is done using low level functions, `ses-rename-cell' is not
76called but instead we use text replacement in the buffer 93called but instead we use text replacement in the buffer
77previously passed in text mode." 94previously passed in text mode."
95 (ses-tests-unbind-local-vars)
78 (let ((ses-initial-size '(2 . 1))) 96 (let ((ses-initial-size '(2 . 1)))
79 (with-temp-buffer 97 (with-temp-buffer
80 (ses-mode) 98 (ses-mode)
@@ -90,11 +108,13 @@ previously passed in text mode."
90 (should-not (local-variable-p 'A1)) 108 (should-not (local-variable-p 'A1))
91 (should (eq ses--foo 1)) 109 (should (eq ses--foo 1))
92 (should (equal (ses-cell-formula 1 0) '(ses-safe-formula (1+ ses--foo)))) 110 (should (equal (ses-cell-formula 1 0) '(ses-safe-formula (1+ ses--foo))))
93 (should (eq (bound-and-true-p A2) 2))))) 111 (should (eq (bound-and-true-p A2) 2))))
112 (ses-tests-check-no-border-effect))
94 113
95(ert-deftest ses-tests-renamed-cell () 114(ert-deftest ses-tests-renamed-cell ()
96 "Check that renaming A1 to `ses--foo' and setting `ses--foo' to 1 and A2 115 "Check that renaming A1 to `ses--foo' and setting `ses--foo' to 1 and A2
97to (1+ ses--foo), makes A2 value equal to 2." 116to (1+ ses--foo), makes A2 value equal to 2."
117 (ses-tests-unbind-local-vars)
98 (let ((ses-initial-size '(2 . 1))) 118 (let ((ses-initial-size '(2 . 1)))
99 (with-temp-buffer 119 (with-temp-buffer
100 (ses-mode) 120 (ses-mode)
@@ -105,11 +125,13 @@ to (1+ ses--foo), makes A2 value equal to 2."
105 (should-not (local-variable-p 'A1)) 125 (should-not (local-variable-p 'A1))
106 (should (eq ses--foo 1)) 126 (should (eq ses--foo 1))
107 (should (equal (ses-cell-formula 1 0) '(1+ ses--foo))) 127 (should (equal (ses-cell-formula 1 0) '(1+ ses--foo)))
108 (should (eq (bound-and-true-p A2) 2))))) 128 (should (eq (bound-and-true-p A2) 2))))
129 (ses-tests-check-no-border-effect))
109 130
110(ert-deftest ses-tests-renamed-cell-after-setting () 131(ert-deftest ses-tests-renamed-cell-after-setting ()
111 "Check that setting A1 to 1 and A2 to (1+ A1), and then 132 "Check that setting A1 to 1 and A2 to (1+ A1), and then
112renaming A1 to `ses--foo' makes `ses--foo' value equal to 2." 133renaming A1 to `ses--foo' makes `ses--foo' value equal to 2."
134 (ses-tests-unbind-local-vars)
113 (let ((ses-initial-size '(2 . 1))) 135 (let ((ses-initial-size '(2 . 1)))
114 (with-temp-buffer 136 (with-temp-buffer
115 (ses-mode) 137 (ses-mode)
@@ -120,12 +142,14 @@ renaming A1 to `ses--foo' makes `ses--foo' value equal to 2."
120 (should-not (local-variable-p 'A1)) 142 (should-not (local-variable-p 'A1))
121 (should (eq ses--foo 1)) 143 (should (eq ses--foo 1))
122 (should (equal (ses-cell-formula 1 0) '(1+ ses--foo))) 144 (should (equal (ses-cell-formula 1 0) '(1+ ses--foo)))
123 (should (eq (bound-and-true-p A2) 2))))) 145 (should (eq (bound-and-true-p A2) 2))))
146 (ses-tests-check-no-border-effect))
124 147
125(ert-deftest ses-tests-renaming-cell-with-one-symbol-formula () 148(ert-deftest ses-tests-renaming-cell-with-one-symbol-formula ()
126 "Check that setting A1 to 1 and A2 to A1, and then renaming A1 149 "Check that setting A1 to 1 and A2 to A1, and then renaming A1
127to `ses--foo' makes `ses--foo' value equal to 1. Then set A1 to 2 and check 150to `ses--foo' makes `ses--foo' value equal to 1. Then set A1 to 2 and check
128that `ses--foo' becomes 2." 151that `ses--foo' becomes 2."
152 (ses-tests-unbind-local-vars)
129 (let ((ses-initial-size '(3 . 1))) 153 (let ((ses-initial-size '(3 . 1)))
130 (with-temp-buffer 154 (with-temp-buffer
131 (ses-mode) 155 (ses-mode)
@@ -141,7 +165,8 @@ that `ses--foo' becomes 2."
141 (funcall-interactively 'ses-edit-cell 0 0 2) 165 (funcall-interactively 'ses-edit-cell 0 0 2)
142 (ses-command-hook); deferred recalc 166 (ses-command-hook); deferred recalc
143 (should (eq (bound-and-true-p A2) 2)) 167 (should (eq (bound-and-true-p A2) 2))
144 (should (eq ses--foo 2))))) 168 (should (eq ses--foo 2))))
169 (ses-tests-check-no-border-effect))
145 170
146 171
147;; ROW INSERTION TESTS 172;; ROW INSERTION TESTS
@@ -151,6 +176,7 @@ that `ses--foo' becomes 2."
151 "Check that setting A1 to 1 and A2 to (1+ A1), and then jumping 176 "Check that setting A1 to 1 and A2 to (1+ A1), and then jumping
152to A2 and inserting a row, makes A2 value empty, and A3 equal to 177to A2 and inserting a row, makes A2 value empty, and A3 equal to
1532." 1782."
179 (ses-tests-unbind-local-vars)
154 (let ((ses-initial-size '(2 . 1))) 180 (let ((ses-initial-size '(2 . 1)))
155 (with-temp-buffer 181 (with-temp-buffer
156 (ses-mode) 182 (ses-mode)
@@ -161,13 +187,15 @@ to A2 and inserting a row, makes A2 value empty, and A3 equal to
161 (ses-insert-row 1) 187 (ses-insert-row 1)
162 (ses-command-hook) 188 (ses-command-hook)
163 (should-not (bound-and-true-p A2)) 189 (should-not (bound-and-true-p A2))
164 (should (eq (bound-and-true-p A3) 2))))) 190 (should (eq (bound-and-true-p A3) 2))))
191 (ses-tests-check-no-border-effect))
165 192
166 193
167(ert-deftest ses-tests-renamed-cells-row-insertion () 194(ert-deftest ses-tests-renamed-cells-row-insertion ()
168 "Check that setting A1 to 1 and A2 to (1+ A1), and then renaming A1 to `ses--foo' and A2 to `ses--bar' jumping 195 "Check that setting A1 to 1 and A2 to (1+ A1), and then renaming A1 to `ses--foo' and A2 to `ses--bar' jumping
169to `ses--bar' and inserting a row, makes A2 value empty, and `ses--bar' equal to 196to `ses--bar' and inserting a row, makes A2 value empty, and `ses--bar' equal to
1702." 1972."
198 (ses-tests-unbind-local-vars)
171 (let ((ses-initial-size '(2 . 1))) 199 (let ((ses-initial-size '(2 . 1)))
172 (with-temp-buffer 200 (with-temp-buffer
173 (ses-mode) 201 (ses-mode)
@@ -183,13 +211,15 @@ to `ses--bar' and inserting a row, makes A2 value empty, and `ses--bar' equal to
183 (ses-insert-row 1) 211 (ses-insert-row 1)
184 (ses-command-hook) 212 (ses-command-hook)
185 (should-not (bound-and-true-p A2)) 213 (should-not (bound-and-true-p A2))
186 (should (eq ses--bar 2))))) 214 (should (eq ses--bar 2))))
215 (ses-tests-check-no-border-effect))
187 216
188 217
189;; JUMP tests 218;; JUMP tests
190;; ====================================================================== 219;; ======================================================================
191(ert-deftest ses-jump-B2-prefix-arg () 220(ert-deftest ses-tests-jump-B2-prefix-arg ()
192 "Test jumping to cell B2 by use of prefix argument" 221 "Test jumping to cell B2 by use of prefix argument"
222 (ses-tests-unbind-local-vars)
193 (let ((ses-initial-size '(3 . 3)) 223 (let ((ses-initial-size '(3 . 3))
194 ses-after-entry-functions) 224 ses-after-entry-functions)
195 (with-temp-buffer 225 (with-temp-buffer
@@ -197,41 +227,49 @@ to `ses--bar' and inserting a row, makes A2 value empty, and `ses--bar' equal to
197 ;; C-u 4 M-x ses-jump 227 ;; C-u 4 M-x ses-jump
198 (let ((current-prefix-arg 4)) 228 (let ((current-prefix-arg 4))
199 (call-interactively 'ses-jump)) 229 (call-interactively 'ses-jump))
200 (should (eq (ses--cell-at-pos (point)) 'B2))))) 230 (should (eq (ses--cell-at-pos (point)) 'B2))))
231 (ses-tests-check-no-border-effect))
201 232
202 233
203(ert-deftest ses-jump-B2-lowcase () 234(ert-deftest ses-tests-jump-B2-lowcase ()
204 "Test jumping to cell B2 by use of lowercase cell name string" 235 "Test jumping to cell B2 by use of lowercase cell name string"
205 (let ((ses-initial-size '(3 . 3)) 236 (ses-tests-unbind-local-vars)
206 ses-after-entry-functions) 237 (let ((ses-initial-size '(3 . 3))
207 (with-temp-buffer 238 ses-after-entry-functions)
208 (ses-mode) 239 (with-temp-buffer
209 (funcall-interactively 'ses-jump "b2") 240 (ses-mode)
210 (ses-command-hook) 241 (funcall-interactively 'ses-jump "b2")
211 (should (eq (ses--cell-at-pos (point)) 'B2))))) 242 (ses-command-hook)
212 243 (should (eq (ses--cell-at-pos (point)) 'B2))))
213(ert-deftest ses-jump-B2-lowcase-keys () 244 (ses-tests-check-no-border-effect))
245
246(ert-deftest ses-tests-jump-B2-lowcase-keys ()
214 "Test jumping to cell B2 by use of lowercase cell name string with simulating keys" 247 "Test jumping to cell B2 by use of lowercase cell name string with simulating keys"
215 (let ((ses-initial-size '(3 . 3)) 248 (ses-tests-unbind-local-vars)
216 ses-after-entry-functions) 249 (let ((ses-initial-size '(3 . 3))
217 (with-temp-buffer 250 ses-after-entry-functions)
218 (ses-mode) 251 (with-temp-buffer
219 (ert-simulate-keys [ ?b ?2 return] (ses-jump)) 252 (ses-mode)
220 (ses-command-hook) 253 (ert-simulate-keys [ ?b ?2 return] (ses-jump))
221 (should (eq (ses--cell-at-pos (point)) 'B2))))) 254 (ses-command-hook)
222 255 (should (eq (ses--cell-at-pos (point)) 'B2))))
223(ert-deftest ses-jump-B2-symbol () 256 (ses-tests-check-no-border-effect))
257
258(ert-deftest ses-tests-jump-B2-symbol ()
224 "Test jumping to cell B2 by use of cell name symbol" 259 "Test jumping to cell B2 by use of cell name symbol"
260 (ses-tests-unbind-local-vars)
225 (let ((ses-initial-size '(3 . 3)) 261 (let ((ses-initial-size '(3 . 3))
226 ses-after-entry-functions) 262 ses-after-entry-functions)
227 (with-temp-buffer 263 (with-temp-buffer
228 (ses-mode) 264 (ses-mode)
229 (funcall-interactively 'ses-jump 'B2) 265 (funcall-interactively 'ses-jump 'B2)
230 (ses-command-hook) 266 (ses-command-hook)
231 (should (eq (ses--cell-at-pos (point)) 'B2))))) 267 (should (eq (ses--cell-at-pos (point)) 'B2))))
268 (ses-tests-check-no-border-effect))
232 269
233(ert-deftest ses-jump-B2-renamed () 270(ert-deftest ses-tests-jump-B2-renamed ()
234 "Test jumping to cell B2 after renaming it `ses--toto'." 271 "Test jumping to cell B2 after renaming it `ses--toto'."
272 (ses-tests-unbind-local-vars)
235 (let ((ses-initial-size '(3 . 3)) 273 (let ((ses-initial-size '(3 . 3))
236 ses-after-entry-functions) 274 ses-after-entry-functions)
237 (with-temp-buffer 275 (with-temp-buffer
@@ -239,12 +277,14 @@ to `ses--bar' and inserting a row, makes A2 value empty, and `ses--bar' equal to
239 (ses-rename-cell 'ses--toto (ses-get-cell 1 1)) 277 (ses-rename-cell 'ses--toto (ses-get-cell 1 1))
240 (ses-jump 'ses--toto) 278 (ses-jump 'ses--toto)
241 (ses-command-hook) 279 (ses-command-hook)
242 (should (eq (ses--cell-at-pos (point)) 'ses--toto))))) 280 (should (eq (ses--cell-at-pos (point)) 'ses--toto))))
281 (ses-tests-check-no-border-effect))
243 282
244(ert-deftest ses-set-formula-write-cells-with-changed-references () 283(ert-deftest ses-tests-set-formula-write-cells-with-changed-references ()
245 "Test fix of bug#5852. 284 "Test fix of bug#5852.
246When setting a formula has some cell with changed references, this 285When setting a formula has some cell with changed references, this
247cell has to be rewritten to data area." 286cell has to be rewritten to data area."
287 (ses-tests-unbind-local-vars)
248 (let ((ses-initial-size '(4 . 3)) 288 (let ((ses-initial-size '(4 . 3))
249 (ses-after-entry-functions nil)) 289 (ses-after-entry-functions nil))
250 (with-temp-buffer 290 (with-temp-buffer
@@ -261,7 +301,8 @@ cell has to be rewritten to data area."
261 (ses-command-hook) 301 (ses-command-hook)
262 (should (equal (ses-cell-references 1 1) '(B3))) 302 (should (equal (ses-cell-references 1 1) '(B3)))
263 (ses-mode) 303 (ses-mode)
264 (should (equal (ses-cell-references 1 1) '(B3)))))) 304 (should (equal (ses-cell-references 1 1) '(B3)))))
305 (ses-tests-check-no-border-effect))
265 306
266(provide 'ses-tests) 307(provide 'ses-tests)
267 308
diff --git a/test/lisp/subr-tests.el b/test/lisp/subr-tests.el
index 3d4f524d630..791b06f9edf 100644
--- a/test/lisp/subr-tests.el
+++ b/test/lisp/subr-tests.el
@@ -1700,32 +1700,38 @@ final or penultimate step during initialization."))
1700 (should (equal (funcall (subr--identity #'all) #'plusp ls) nil)) 1700 (should (equal (funcall (subr--identity #'all) #'plusp ls) nil))
1701 (should (equal (funcall (subr--identity #'all) #'numberp ls) t)))) 1701 (should (equal (funcall (subr--identity #'all) #'numberp ls) t))))
1702 1702
1703(ert-deftest subr-any () 1703(ert-deftest subr-member-if ()
1704 (should (equal (any #'hash-table-p nil) nil)) 1704 (should (equal (member-if #'hash-table-p nil) nil))
1705 (let ((ls (append '(3 2 1) '(0) '(-1 -2 -3)))) 1705 (let ((ls (append '(3 2 1) '(0) '(-1 -2 -3))))
1706 (should (equal (any #'numberp ls) ls)) 1706 (should (equal (member-if #'numberp ls) ls))
1707 (should (equal (any (lambda (x) (numberp x)) ls) ls)) 1707 (should (equal (member-if (lambda (x) (numberp x)) ls) ls))
1708 (should (equal (any #'plusp ls) ls)) 1708 (should (equal (member-if #'plusp ls) ls))
1709 (should (equal (any #'zerop ls) '(0 -1 -2 -3))) 1709 (should (equal (member-if #'zerop ls) '(0 -1 -2 -3)))
1710 (should (equal (any #'bufferp ls) nil)) 1710 (should (equal (member-if #'bufferp ls) nil))
1711 (let ((z 9)) 1711 (let ((z 9))
1712 (should (equal (any (lambda (x) (< x z)) ls) ls)) 1712 (should (equal (member-if (lambda (x) (< x z)) ls) ls))
1713 (should (equal (any (lambda (x) (< x (- z 9))) ls) '(-1 -2 -3))) 1713 (should (equal (member-if (lambda (x) (< x (- z 9))) ls)
1714 (should (equal (any (lambda (x) (> x z)) ls) nil))) 1714 '(-1 -2 -3)))
1715 (should (equal (funcall (subr--identity #'any) #'minusp ls) '(-1 -2 -3))) 1715 (should (equal (member-if (lambda (x) (> x z)) ls) nil)))
1716 (should (equal (funcall (subr--identity #'any) #'stringp ls) nil)))) 1716 (should (equal (funcall (subr--identity #'member-if) #'minusp ls)
1717 1717 '(-1 -2 -3)))
1718(defun subr-tests--any-memql (x xs) 1718 (should (equal (funcall (subr--identity #'member-if) #'stringp ls) nil))))
1719 "Like `memql', but exercising the `compiler-macro' of `any'. 1719
1720(defun subr-tests--member-if-memql (x xs)
1721 "Like `memql', but exercising the `compiler-macro' of `member-if'.
1720The argument names are important." 1722The argument names are important."
1721 (any (lambda (y) (eql x y)) xs)) 1723 (member-if (lambda (y) (eql x y)) xs))
1722 1724
1723(ert-deftest subr-any-compiler-macro () 1725(ert-deftest subr-member-if-compiler-macro ()
1724 "Test `compiler-macro' of `any'." 1726 "Test `compiler-macro' of `member-if'."
1725 (let ((xs (number-sequence 0 4))) 1727 (let ((xs (number-sequence 0 4)))
1726 (dotimes (x (1+ (length xs))) 1728 (dotimes (x (1+ (length xs)))
1727 (should (eq (subr-tests--any-memql x xs) 1729 (should (eq (subr-tests--member-if-memql x xs)
1728 (memql x xs)))))) 1730 (memql x xs)))))
1731 (let ((n 0))
1732 (member-if (prog1 (lambda (x) (eq x 5)) (incf n))
1733 (number-sequence 0 4))
1734 (should (eq n 1))))
1729 1735
1730(ert-deftest total-line-spacing () 1736(ert-deftest total-line-spacing ()
1731 (progn 1737 (progn
diff --git a/test/lisp/xt-mouse-tests.el b/test/lisp/xt-mouse-tests.el
index 26fe5002b68..b065fda5eed 100644
--- a/test/lisp/xt-mouse-tests.el
+++ b/test/lisp/xt-mouse-tests.el
@@ -50,8 +50,7 @@
50 ;; `xterm-mouse-mode' doesn't work in the initial 50 ;; `xterm-mouse-mode' doesn't work in the initial
51 ;; terminal. Since we can't create a second 51 ;; terminal. Since we can't create a second
52 ;; terminal in batch mode, fake it temporarily. 52 ;; terminal in batch mode, fake it temporarily.
53 (cl-letf (((symbol-function 'terminal-name) 53 (cl-letf (((symbol-function 'frame-initial-p) #'ignore))
54 (lambda (&optional _terminal) "fake-terminal")))
55 (xterm-mouse-mode 1)) 54 (xterm-mouse-mode 1))
56 ,@body) 55 ,@body)
57 (xterm-mouse-mode 0)))) 56 (xterm-mouse-mode 0))))
diff --git a/test/src/terminal-tests.el b/test/src/terminal-tests.el
new file mode 100644
index 00000000000..85c4fa04efc
--- /dev/null
+++ b/test/src/terminal-tests.el
@@ -0,0 +1,55 @@
1;;; terminal-tests.el --- tests for terminal.c -*- lexical-binding: t -*-
2
3;; Copyright (C) 2026 Free Software Foundation, Inc.
4
5;; This file is part of GNU Emacs.
6
7;; GNU Emacs is free software: you can redistribute it and/or modify
8;; it under the terms of the GNU General Public License as published by
9;; the Free Software Foundation, either version 3 of the License, or
10;; (at your option) any later version.
11
12;; GNU Emacs is distributed in the hope that it will be useful,
13;; but WITHOUT ANY WARRANTY; without even the implied warranty of
14;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15;; GNU General Public License for more details.
16
17;; You should have received a copy of the GNU General Public License
18;; along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
19
20;;; Code:
21
22(require 'ert)
23
24(ert-deftest frame-initial-p ()
25 "Test `frame-initial-p' behavior."
26 (should-not (frame-initial-p t))
27 (should-not (frame-initial-p (current-buffer)))
28 (should-not (frame-initial-p (selected-window)))
29 ;; "Initial frame" implies "initial terminal", and
30 ;; no other terminal can have the initial frame.
31 (should-not (xor (equal (terminal-name) "initial_terminal")
32 (frame-initial-p)))
33 ;; Initial frame implies its terminal is a termcap-like
34 ;; text-mode terminal.
35 (should (or (not (frame-initial-p))
36 (eq (terminal-live-p nil) t)))
37 ;; It similarly implies a termcap-like text-mode frame.
38 (should (or (not (frame-initial-p))
39 (eq (frame-live-p (selected-frame)) t)))
40 (dolist (ft (append '(nil) (frame-list) (terminal-list)))
41 (ert-info ((prin1-to-string ft) :prefix "Argument: ")
42 (should-not (xor (equal (terminal-name ft) "initial_terminal")
43 (frame-initial-p ft)))
44 (should (or (not (frame-initial-p ft))
45 (eq (terminal-live-p ft) t)))))
46 (cond (noninteractive
47 ;; Batch mode should have an initial frame.
48 (should (any #'frame-initial-p (frame-list)))
49 (should (any #'frame-initial-p (terminal-list))))
50 ((not (daemonp))
51 ;; Non-daemon interactive mode should have none.
52 (should-not (any #'frame-initial-p (frame-list)))
53 (should-not (any #'frame-initial-p (terminal-list))))))
54
55;;; terminal-tests.el ends here