aboutsummaryrefslogtreecommitdiffstats
path: root/test/src
diff options
context:
space:
mode:
authorAndrea Corallo2021-02-10 21:56:55 +0100
committerAndrea Corallo2021-02-10 21:56:55 +0100
commit2fcb85c3e780f1f2871ce0f300cfaffce9836eb0 (patch)
treea8857ccad8bff12080062a3edaad1a55a3eb8171 /test/src
parent1f626e9662d8120acd5a937f847123cc2b8c6e31 (diff)
parent6bfdfeed36fab4680c8db90c22da8f6611694186 (diff)
downloademacs-2fcb85c3e780f1f2871ce0f300cfaffce9836eb0.tar.gz
emacs-2fcb85c3e780f1f2871ce0f300cfaffce9836eb0.zip
Merge remote-tracking branch 'savannah/master' into HEAD
Diffstat (limited to 'test/src')
-rw-r--r--test/src/editfns-tests.el22
-rw-r--r--test/src/fns-tests.el30
-rw-r--r--test/src/indent-tests.el22
-rw-r--r--test/src/minibuf-tests.el8
-rw-r--r--test/src/process-tests.el28
5 files changed, 83 insertions, 27 deletions
diff --git a/test/src/editfns-tests.el b/test/src/editfns-tests.el
index 64f9137865b..dcec971c12e 100644
--- a/test/src/editfns-tests.el
+++ b/test/src/editfns-tests.el
@@ -106,7 +106,27 @@
106 #("foobar" 3 6 (face error)))) 106 #("foobar" 3 6 (face error))))
107 (should (ert-equal-including-properties 107 (should (ert-equal-including-properties
108 (format (concat "%s " (propertize "%s" 'face 'error)) "foo" "bar") 108 (format (concat "%s " (propertize "%s" 'face 'error)) "foo" "bar")
109 #("foo bar" 4 7 (face error))))) 109 #("foo bar" 4 7 (face error))))
110 ;; Bug #46317
111 (let ((s (propertize "X" 'prop "val")))
112 (should (ert-equal-including-properties
113 (format (concat "%3s/" s) 12)
114 #(" 12/X" 4 5 (prop "val"))))
115 (should (ert-equal-including-properties
116 (format (concat "%3S/" s) 12)
117 #(" 12/X" 4 5 (prop "val"))))
118 (should (ert-equal-including-properties
119 (format (concat "%3d/" s) 12)
120 #(" 12/X" 4 5 (prop "val"))))
121 (should (ert-equal-including-properties
122 (format (concat "%-3s/" s) 12)
123 #("12 /X" 4 5 (prop "val"))))
124 (should (ert-equal-including-properties
125 (format (concat "%-3S/" s) 12)
126 #("12 /X" 4 5 (prop "val"))))
127 (should (ert-equal-including-properties
128 (format (concat "%-3d/" s) 12)
129 #("12 /X" 4 5 (prop "val"))))))
110 130
111;; Tests for bug#5131. 131;; Tests for bug#5131.
112(defun transpose-test-reverse-word (start end) 132(defun transpose-test-reverse-word (start end)
diff --git a/test/src/fns-tests.el b/test/src/fns-tests.el
index e0aed2a71b6..9f6593a177c 100644
--- a/test/src/fns-tests.el
+++ b/test/src/fns-tests.el
@@ -4,18 +4,18 @@
4 4
5;; This file is part of GNU Emacs. 5;; This file is part of GNU Emacs.
6 6
7;; This program is free software: you can redistribute it and/or 7;; GNU Emacs is free software: you can redistribute it and/or modify
8;; modify it under the terms of the GNU General Public License as 8;; it under the terms of the GNU General Public License as published by
9;; published by the Free Software Foundation, either version 3 of the 9;; the Free Software Foundation, either version 3 of the License, or
10;; License, or (at your option) any later version. 10;; (at your option) any later version.
11;; 11
12;; This program is distributed in the hope that it will be useful, but 12;; GNU Emacs is distributed in the hope that it will be useful,
13;; WITHOUT ANY WARRANTY; without even the implied warranty of 13;; but WITHOUT ANY WARRANTY; without even the implied warranty of
14;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15;; General Public License for more details. 15;; GNU General Public License for more details.
16;; 16
17;; You should have received a copy of the GNU General Public License 17;; You should have received a copy of the GNU General Public License
18;; along with this program. If not, see `https://www.gnu.org/licenses/'. 18;; along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
19 19
20;;; Commentary: 20;;; Commentary:
21 21
@@ -1098,3 +1098,11 @@
1098 (goto-char (point-max)) 1098 (goto-char (point-max))
1099 (insert "fóo") 1099 (insert "fóo")
1100 (should (approx-equal (buffer-line-statistics) '(1002 50 49.9))))) 1100 (should (approx-equal (buffer-line-statistics) '(1002 50 49.9)))))
1101
1102(ert-deftest test-line-number-at-position ()
1103 (with-temp-buffer
1104 (insert (make-string 10 ?\n))
1105 (should (= (line-number-at-pos (point)) 11))
1106 (should (= (line-number-at-pos nil) 11))
1107 (should-error (line-number-at-pos -1))
1108 (should-error (line-number-at-pos 100))))
diff --git a/test/src/indent-tests.el b/test/src/indent-tests.el
index 10f1202949b..6a3f1a5c95f 100644
--- a/test/src/indent-tests.el
+++ b/test/src/indent-tests.el
@@ -4,18 +4,18 @@
4 4
5;; This file is part of GNU Emacs. 5;; This file is part of GNU Emacs.
6 6
7;; This program is free software: you can redistribute it and/or 7;; GNU Emacs is free software: you can redistribute it and/or modify
8;; modify it under the terms of the GNU General Public License as 8;; it under the terms of the GNU General Public License as published by
9;; published by the Free Software Foundation, either version 3 of the 9;; the Free Software Foundation, either version 3 of the License, or
10;; License, or (at your option) any later version. 10;; (at your option) any later version.
11;; 11
12;; This program is distributed in the hope that it will be useful, but 12;; GNU Emacs is distributed in the hope that it will be useful,
13;; WITHOUT ANY WARRANTY; without even the implied warranty of 13;; but WITHOUT ANY WARRANTY; without even the implied warranty of
14;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15;; General Public License for more details. 15;; GNU General Public License for more details.
16;; 16
17;; You should have received a copy of the GNU General Public License 17;; You should have received a copy of the GNU General Public License
18;; along with this program. If not, see `https://www.gnu.org/licenses/'. 18;; along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
19 19
20;;; Commentary: 20;;; Commentary:
21 21
diff --git a/test/src/minibuf-tests.el b/test/src/minibuf-tests.el
index 28119fc999e..c55611eb84b 100644
--- a/test/src/minibuf-tests.el
+++ b/test/src/minibuf-tests.el
@@ -412,11 +412,11 @@
412 412
413(ert-deftest test-inhibit-interaction () 413(ert-deftest test-inhibit-interaction ()
414 (let ((inhibit-interaction t)) 414 (let ((inhibit-interaction t))
415 (should-error (read-from-minibuffer "foo: ")) 415 (should-error (read-from-minibuffer "foo: ") :type 'inhibited-interaction)
416 416
417 (should-error (y-or-n-p "foo: ")) 417 (should-error (y-or-n-p "foo: ") :type 'inhibited-interaction)
418 (should-error (yes-or-no-p "foo: ")) 418 (should-error (yes-or-no-p "foo: ") :type 'inhibited-interaction)
419 (should-error (read-blanks-no-input "foo: ")) 419 (should-error (read-no-blanks-input "foo: ") :type 'inhibited-interaction)
420 420
421 ;; See that we get the expected error. 421 ;; See that we get the expected error.
422 (should (eq (condition-case nil 422 (should (eq (condition-case nil
diff --git a/test/src/process-tests.el b/test/src/process-tests.el
index a3fba8d328b..e62bcb3f7c0 100644
--- a/test/src/process-tests.el
+++ b/test/src/process-tests.el
@@ -879,5 +879,33 @@ Return nil if FILENAME doesn't exist."
879 (file-regular-p filename) 879 (file-regular-p filename)
880 filename))) 880 filename)))
881 881
882;; Bug#46284
883(ert-deftest process-sentinel-interrupt-event ()
884 "Test that interrupting a process on Windows sends \"interrupt\" to sentinel."
885 (skip-unless (eq system-type 'windows-nt))
886 (with-temp-buffer
887 (let* ((proc-buf (current-buffer))
888 ;; Start a new emacs process to wait idly until interrupted.
889 (cmd "emacs -batch --eval=\"(sit-for 50000)\"")
890 (proc (start-file-process-shell-command
891 "test/process-sentinel-signal-event" proc-buf cmd))
892 (events '()))
893
894 ;; Capture any incoming events.
895 (set-process-sentinel proc
896 (lambda (_prc event)
897 (push event events)))
898 ;; Wait for the process to start.
899 (sleep-for 2)
900 (should (equal 'run (process-status proc)))
901 ;; Interrupt the sub-process and wait for it to die.
902 (interrupt-process proc)
903 (sleep-for 2)
904 ;; Should have received SIGINT...
905 (should (equal 'signal (process-status proc)))
906 (should (equal 2 (process-exit-status proc)))
907 ;; ...and the change description should be "interrupt".
908 (should (equal '("interrupt\n") events)))))
909
882(provide 'process-tests) 910(provide 'process-tests)
883;;; process-tests.el ends here 911;;; process-tests.el ends here