diff options
| author | Andrea Corallo | 2021-01-16 13:26:10 +0100 |
|---|---|---|
| committer | Andrea Corallo | 2021-01-16 13:26:10 +0100 |
| commit | 0a7ac0b5504e75275699a3d8d2d5d94bcfda8708 (patch) | |
| tree | bb6158c8a9edeb1e716718abfc98dca16aef9e9e /test | |
| parent | f1efac1f9efbfa15b6434ebef507c00c1277633f (diff) | |
| parent | 0732fc31932c75c682c8b65b4dcb4376ca63e8fd (diff) | |
| download | emacs-0a7ac0b5504e75275699a3d8d2d5d94bcfda8708.tar.gz emacs-0a7ac0b5504e75275699a3d8d2d5d94bcfda8708.zip | |
Merge remote-tracking branch 'savannah/master' into native-comp
Diffstat (limited to 'test')
28 files changed, 669 insertions, 147 deletions
diff --git a/test/Makefile.in b/test/Makefile.in index 68ad1a35796..849fbbf474e 100644 --- a/test/Makefile.in +++ b/test/Makefile.in | |||
| @@ -253,6 +253,12 @@ endef | |||
| 253 | 253 | ||
| 254 | $(foreach test,${TESTS},$(eval $(call test_template,${test}))) | 254 | $(foreach test,${TESTS},$(eval $(call test_template,${test}))) |
| 255 | 255 | ||
| 256 | # Get the tests for only a specific directory | ||
| 257 | NET_TESTS := $(patsubst %.el,%,$(wildcard lisp/net/*.el)) | ||
| 258 | LISP_TESTS := $(patsubst %.el,%,$(wildcard lisp/*.el)) | ||
| 259 | check-net: ${NET_TESTS} | ||
| 260 | check-lisp: ${LISP_TESTS} | ||
| 261 | |||
| 256 | ifeq (@HAVE_MODULES@, yes) | 262 | ifeq (@HAVE_MODULES@, yes) |
| 257 | # -fPIC is a no-op on Windows, but causes a compiler warning | 263 | # -fPIC is a no-op on Windows, but causes a compiler warning |
| 258 | ifeq ($(SO),.dll) | 264 | ifeq ($(SO),.dll) |
diff --git a/test/README b/test/README index ec566cb58dc..38f4a109701 100644 --- a/test/README +++ b/test/README | |||
| @@ -39,6 +39,12 @@ The Makefile in this directory supports the following targets: | |||
| 39 | * make check-all | 39 | * make check-all |
| 40 | Like "make check", but run all tests. | 40 | Like "make check", but run all tests. |
| 41 | 41 | ||
| 42 | * make check-lisp | ||
| 43 | Like "make check", but run only the tests in test/lisp/*.el | ||
| 44 | |||
| 45 | * make check-net | ||
| 46 | Like "make check", but run only the tests in test/lisp/net/*.el | ||
| 47 | |||
| 42 | * make <filename> -or- make <filename>.log | 48 | * make <filename> -or- make <filename>.log |
| 43 | Run all tests declared in <filename>.el. This includes expensive | 49 | Run all tests declared in <filename>.el. This includes expensive |
| 44 | tests. In the former case the output is shown on the terminal, in | 50 | tests. In the former case the output is shown on the terminal, in |
diff --git a/test/file-organization.org b/test/file-organization.org index 64c0755b3bc..efc354529c5 100644 --- a/test/file-organization.org +++ b/test/file-organization.org | |||
| @@ -57,3 +57,8 @@ directory called ~test/lisp/progmodes/flymake-resources~. | |||
| 57 | No guidance is given for the organization of resource files inside the | 57 | No guidance is given for the organization of resource files inside the |
| 58 | ~-resources~ directory; files can be organized at the author's | 58 | ~-resources~ directory; files can be organized at the author's |
| 59 | discretion. | 59 | discretion. |
| 60 | |||
| 61 | ** Testing Infrastructure Files | ||
| 62 | |||
| 63 | Files used to support testing infrastructure such as EMBA should be | ||
| 64 | placed in ~infra~. | ||
diff --git a/test/infra/Dockerfile.emba b/test/infra/Dockerfile.emba new file mode 100644 index 00000000000..dd41982ad59 --- /dev/null +++ b/test/infra/Dockerfile.emba | |||
| @@ -0,0 +1,71 @@ | |||
| 1 | # Copyright (C) 2021 Free Software Foundation, Inc. | ||
| 2 | # | ||
| 3 | # This file is part of GNU Emacs. | ||
| 4 | # | ||
| 5 | # GNU Emacs is free software: you can redistribute it and/or modify | ||
| 6 | # it under the terms of the GNU General Public License as published by | ||
| 7 | # the Free Software Foundation, either version 3 of the License, or | ||
| 8 | # (at your option) any later version. | ||
| 9 | # | ||
| 10 | # GNU Emacs is distributed in the hope that it will be useful, | ||
| 11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 13 | # GNU General Public License for more details. | ||
| 14 | # | ||
| 15 | # You should have received a copy of the GNU General Public License | ||
| 16 | # along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. | ||
| 17 | |||
| 18 | # GNU Emacs support for the GitLab-specific build of Docker images. | ||
| 19 | |||
| 20 | # The presence of this file does not imply any FSF/GNU endorsement of | ||
| 21 | # Docker or any other particular tool. Also, it is intended for | ||
| 22 | # evaluation purposes, thus possibly temporary. | ||
| 23 | |||
| 24 | # Maintainer: Ted Zlatanov <tzz@lifelogs.com> | ||
| 25 | # URL: https://emba.gnu.org/emacs/emacs | ||
| 26 | |||
| 27 | FROM debian:stretch as emacs-base | ||
| 28 | |||
| 29 | RUN apt-get update && \ | ||
| 30 | apt-get install -y --no-install-recommends -o=Dpkg::Use-Pty=0 \ | ||
| 31 | libc-dev gcc g++ make autoconf automake libncurses-dev gnutls-dev git \ | ||
| 32 | && rm -rf /var/lib/apt/lists/* | ||
| 33 | |||
| 34 | FROM emacs-base as emacs-inotify | ||
| 35 | |||
| 36 | RUN apt-get update && \ | ||
| 37 | apt-get install -y --no-install-recommends -o=Dpkg::Use-Pty=0 inotify-tools \ | ||
| 38 | && rm -rf /var/lib/apt/lists/* | ||
| 39 | |||
| 40 | COPY . /checkout | ||
| 41 | WORKDIR /checkout | ||
| 42 | RUN ./autogen.sh autoconf | ||
| 43 | RUN ./configure --without-makeinfo | ||
| 44 | RUN make bootstrap | ||
| 45 | RUN make -j4 | ||
| 46 | |||
| 47 | FROM emacs-base as emacs-filenotify-gio | ||
| 48 | |||
| 49 | RUN apt-get update && \ | ||
| 50 | apt-get install -y --no-install-recommends -o=Dpkg::Use-Pty=0 libglib2.0-dev libglib2.0-bin libglib2.0-0 \ | ||
| 51 | && rm -rf /var/lib/apt/lists/* | ||
| 52 | |||
| 53 | COPY . /checkout | ||
| 54 | WORKDIR /checkout | ||
| 55 | RUN ./autogen.sh autoconf | ||
| 56 | RUN ./configure --without-makeinfo --with-file-notification=gfile | ||
| 57 | RUN make bootstrap | ||
| 58 | RUN make -j4 | ||
| 59 | |||
| 60 | FROM emacs-base as emacs-gnustep | ||
| 61 | |||
| 62 | RUN apt-get update && \ | ||
| 63 | apt-get install -y --no-install-recommends -o=Dpkg::Use-Pty=0 gnustep-devel \ | ||
| 64 | && rm -rf /var/lib/apt/lists/* | ||
| 65 | |||
| 66 | COPY . /checkout | ||
| 67 | WORKDIR /checkout | ||
| 68 | RUN ./autogen.sh autoconf | ||
| 69 | RUN ./configure --without-makeinfo --with-ns | ||
| 70 | RUN make bootstrap | ||
| 71 | RUN make -j4 | ||
diff --git a/test/lisp/calendar/lunar-tests.el b/test/lisp/calendar/lunar-tests.el index 5f1f6782f1a..268dcfdb550 100644 --- a/test/lisp/calendar/lunar-tests.el +++ b/test/lisp/calendar/lunar-tests.el | |||
| @@ -27,39 +27,37 @@ | |||
| 27 | (defmacro with-lunar-test (&rest body) | 27 | (defmacro with-lunar-test (&rest body) |
| 28 | `(let ((calendar-latitude 40.1) | 28 | `(let ((calendar-latitude 40.1) |
| 29 | (calendar-longitude -88.2) | 29 | (calendar-longitude -88.2) |
| 30 | (calendar-location-name "Urbana, IL") | 30 | (calendar-location-name "Paris") |
| 31 | (calendar-time-zone -360) | 31 | (calendar-time-zone 0) |
| 32 | (calendar-standard-time-zone-name "CST") | 32 | (calendar-standard-time-zone-name "UTC") |
| 33 | (calendar-time-display-form '(12-hours ":" minutes am-pm))) | 33 | ;; Make sure daylight saving is disabled to avoid interference |
| 34 | ;; from the system settings (see bug#45818). | ||
| 35 | (calendar-daylight-savings-starts nil) | ||
| 36 | (calendar-time-display-form '(24-hours ":" minutes))) | ||
| 34 | ,@body)) | 37 | ,@body)) |
| 35 | 38 | ||
| 36 | (ert-deftest lunar-test-phase () | 39 | (ert-deftest lunar-test-phase () |
| 37 | (with-lunar-test | 40 | (with-lunar-test |
| 38 | (should (equal (lunar-phase 1) | 41 | (should (equal (lunar-phase 1) |
| 39 | '((1 7 1900) "11:40pm" 1 ""))))) | 42 | '((1 8 1900) "05:40" 1 ""))))) |
| 40 | 43 | ||
| 41 | (ert-deftest lunar-test-eclipse-check () | 44 | (ert-deftest lunar-test-eclipse-check () |
| 42 | (with-lunar-test | 45 | (with-lunar-test |
| 43 | (should (equal (eclipse-check 1 1) "** Eclipse **")))) | 46 | (should (equal (eclipse-check 1 1) "** Eclipse **")))) |
| 44 | 47 | ||
| 45 | ;; This fails in certain time zones. | ||
| 46 | ;; Eg TZ=America/Phoenix make lisp/calendar/lunar-tests | ||
| 47 | ;; Similarly with TZ=UTC. | ||
| 48 | ;; Daylight saving related? | ||
| 49 | (ert-deftest lunar-test-phase-list () | 48 | (ert-deftest lunar-test-phase-list () |
| 50 | :tags '(:unstable) | ||
| 51 | (with-lunar-test | 49 | (with-lunar-test |
| 52 | (should (equal (lunar-phase-list 3 1871) | 50 | (should (equal (lunar-phase-list 3 1871) |
| 53 | '(((3 20 1871) "11:03pm" 0 "") | 51 | '(((3 21 1871) "04:03" 0 "") |
| 54 | ((3 29 1871) "1:46am" 1 "** Eclipse **") | 52 | ((3 29 1871) "06:46" 1 "** Eclipse **") |
| 55 | ((4 5 1871) "9:20am" 2 "") | 53 | ((4 5 1871) "14:20" 2 "") |
| 56 | ((4 12 1871) "12:57am" 3 "** Eclipse possible **") | 54 | ((4 12 1871) "05:57" 3 "** Eclipse possible **") |
| 57 | ((4 19 1871) "2:06pm" 0 "") | 55 | ((4 19 1871) "19:06" 0 "") |
| 58 | ((4 27 1871) "6:49pm" 1 "") | 56 | ((4 27 1871) "23:49" 1 "") |
| 59 | ((5 4 1871) "5:57pm" 2 "") | 57 | ((5 4 1871) "22:57" 2 "") |
| 60 | ((5 11 1871) "9:29am" 3 "") | 58 | ((5 11 1871) "14:29" 3 "") |
| 61 | ((5 19 1871) "5:46am" 0 "") | 59 | ((5 19 1871) "10:46" 0 "") |
| 62 | ((5 27 1871) "8:02am" 1 "")))))) | 60 | ((5 27 1871) "13:02" 1 "")))))) |
| 63 | 61 | ||
| 64 | (ert-deftest lunar-test-new-moon-time () | 62 | (ert-deftest lunar-test-new-moon-time () |
| 65 | (with-lunar-test | 63 | (with-lunar-test |
diff --git a/test/lisp/calendar/solar-tests.el b/test/lisp/calendar/solar-tests.el index 7a37f8db558..337deb8ce9a 100644 --- a/test/lisp/calendar/solar-tests.el +++ b/test/lisp/calendar/solar-tests.el | |||
| @@ -26,7 +26,9 @@ | |||
| 26 | (calendar-longitude 75.8) | 26 | (calendar-longitude 75.8) |
| 27 | (calendar-time-zone +330) | 27 | (calendar-time-zone +330) |
| 28 | (calendar-standard-time-zone-name "IST") | 28 | (calendar-standard-time-zone-name "IST") |
| 29 | (calendar-daylight-time-zone-name "IST") | 29 | ;; Make sure our clockwork isn't confused by daylight saving rules |
| 30 | ;; in effect for any other time zone (bug#45818). | ||
| 31 | (calendar-daylight-savings-starts nil) | ||
| 30 | (epsilon (/ 60.0))) ; Minute accuracy is good enough. | 32 | (epsilon (/ 60.0))) ; Minute accuracy is good enough. |
| 31 | (let* ((sunrise-sunset (solar-sunrise-sunset '(12 30 2020))) | 33 | (let* ((sunrise-sunset (solar-sunrise-sunset '(12 30 2020))) |
| 32 | (sunrise (car (nth 0 sunrise-sunset))) | 34 | (sunrise (car (nth 0 sunrise-sunset))) |
diff --git a/test/lisp/cedet/semantic-utest.el b/test/lisp/cedet/semantic-utest.el index c0099386f1c..67de4a5b02d 100644 --- a/test/lisp/cedet/semantic-utest.el +++ b/test/lisp/cedet/semantic-utest.el | |||
| @@ -577,10 +577,8 @@ INSERTME is the text to be inserted after the deletion." | |||
| 577 | 577 | ||
| 578 | 578 | ||
| 579 | (ert-deftest semantic-utest-Javascript() | 579 | (ert-deftest semantic-utest-Javascript() |
| 580 | (if (fboundp 'javascript-mode) | 580 | (skip-unless (fboundp 'javascript-mode)) |
| 581 | (semantic-utest-generic (semantic-utest-fname "javascripttest.js") semantic-utest-Javascript-buffer-contents semantic-utest-Javascript-name-contents '("fun2") "//1" "//deleted line") | 581 | (semantic-utest-generic (semantic-utest-fname "javascripttest.js") semantic-utest-Javascript-buffer-contents semantic-utest-Javascript-name-contents '("fun2") "//1" "//deleted line")) |
| 582 | (message "Skipping JavaScript test: NO major mode.")) | ||
| 583 | ) | ||
| 584 | 582 | ||
| 585 | (ert-deftest semantic-utest-Java() | 583 | (ert-deftest semantic-utest-Java() |
| 586 | ;; If JDE is installed, it might mess things up depending on the version | 584 | ;; If JDE is installed, it might mess things up depending on the version |
diff --git a/test/lisp/cedet/srecode-utest-getset.el b/test/lisp/cedet/srecode-utest-getset.el index 0497dea505d..1c6578038c0 100644 --- a/test/lisp/cedet/srecode-utest-getset.el +++ b/test/lisp/cedet/srecode-utest-getset.el | |||
| @@ -128,7 +128,6 @@ private: | |||
| 128 | (srecode-utest-getset-jumptotag "miscFunction")) | 128 | (srecode-utest-getset-jumptotag "miscFunction")) |
| 129 | 129 | ||
| 130 | (let ((pos (point))) | 130 | (let ((pos (point))) |
| 131 | (skip-chars-backward " \t\n") ; xemacs forward-comment is different. | ||
| 132 | (forward-comment -1) | 131 | (forward-comment -1) |
| 133 | (re-search-forward "miscFunction" pos)) | 132 | (re-search-forward "miscFunction" pos)) |
| 134 | 133 | ||
diff --git a/test/lisp/cedet/srecode-utest-template.el b/test/lisp/cedet/srecode-utest-template.el index 57d8a648050..f97ff18320e 100644 --- a/test/lisp/cedet/srecode-utest-template.el +++ b/test/lisp/cedet/srecode-utest-template.el | |||
| @@ -307,13 +307,9 @@ INSIDE SECTION: ARG HANDLER ONE") | |||
| 307 | (should (srecode-table major-mode)) | 307 | (should (srecode-table major-mode)) |
| 308 | 308 | ||
| 309 | ;; Loop over the output testpoints. | 309 | ;; Loop over the output testpoints. |
| 310 | |||
| 311 | (dolist (p srecode-utest-output-entries) | 310 | (dolist (p srecode-utest-output-entries) |
| 312 | (set-buffer testbuff) ;; XEmacs causes a buffer switch. I don't know why | 311 | (should-not (srecode-utest-test p))))) |
| 313 | (should-not (srecode-utest-test p)) | ||
| 314 | ) | ||
| 315 | 312 | ||
| 316 | )) | ||
| 317 | (when (file-exists-p srecode-utest-testfile) | 313 | (when (file-exists-p srecode-utest-testfile) |
| 318 | (delete-file srecode-utest-testfile))) | 314 | (delete-file srecode-utest-testfile))) |
| 319 | 315 | ||
diff --git a/test/lisp/emacs-lisp/cl-macs-tests.el b/test/lisp/emacs-lisp/cl-macs-tests.el index 446983c2e3e..bcd63f73a3c 100644 --- a/test/lisp/emacs-lisp/cl-macs-tests.el +++ b/test/lisp/emacs-lisp/cl-macs-tests.el | |||
| @@ -610,4 +610,27 @@ collection clause." | |||
| 610 | ;; Just make sure the function can be instrumented. | 610 | ;; Just make sure the function can be instrumented. |
| 611 | (edebug-defun))) | 611 | (edebug-defun))) |
| 612 | 612 | ||
| 613 | ;;; cl-labels | ||
| 614 | |||
| 615 | (ert-deftest cl-macs--labels () | ||
| 616 | ;; Simple recursive function. | ||
| 617 | (cl-labels ((len (xs) (if xs (1+ (len (cdr xs))) 0))) | ||
| 618 | (should (equal (len (make-list 42 t)) 42))) | ||
| 619 | |||
| 620 | ;; Simple tail-recursive function. | ||
| 621 | (cl-labels ((len (xs n) (if xs (len (cdr xs) (1+ n)) n))) | ||
| 622 | (should (equal (len (make-list 42 t) 0) 42)) | ||
| 623 | ;; Should not bump into stack depth limits. | ||
| 624 | (should (equal (len (make-list 42000 t) 0) 42000))) | ||
| 625 | |||
| 626 | ;; Check that non-recursive functions are handled more efficiently. | ||
| 627 | (should (pcase (macroexpand '(cl-labels ((f (x) (+ x 1))) (f 5))) | ||
| 628 | (`(let* ,_ (funcall ,_ 5)) t))) | ||
| 629 | |||
| 630 | ;; Case of "tail-recursive lambdas". | ||
| 631 | (should (pcase (macroexpand | ||
| 632 | '(cl-labels ((len (xs n) (if xs (len (cdr xs) (1+ n)) n))) | ||
| 633 | #'len)) | ||
| 634 | (`(function (lambda (,_ ,_) . ,_)) t)))) | ||
| 635 | |||
| 613 | ;;; cl-macs-tests.el ends here | 636 | ;;; cl-macs-tests.el ends here |
diff --git a/test/lisp/emacs-lisp/timer-tests.el b/test/lisp/emacs-lisp/timer-tests.el index 74da33eff69..7856c217f9e 100644 --- a/test/lisp/emacs-lisp/timer-tests.el +++ b/test/lisp/emacs-lisp/timer-tests.el | |||
| @@ -36,8 +36,8 @@ | |||
| 36 | 36 | ||
| 37 | (ert-deftest timer-tests-debug-timer-check () | 37 | (ert-deftest timer-tests-debug-timer-check () |
| 38 | ;; This function exists only if --enable-checking. | 38 | ;; This function exists only if --enable-checking. |
| 39 | (if (fboundp 'debug-timer-check) | 39 | (skip-unless (fboundp 'debug-timer-check)) |
| 40 | (should (debug-timer-check)) t)) | 40 | (should (debug-timer-check))) |
| 41 | 41 | ||
| 42 | (ert-deftest timer-test-multiple-of-time () | 42 | (ert-deftest timer-test-multiple-of-time () |
| 43 | (should (time-equal-p | 43 | (should (time-equal-p |
diff --git a/test/lisp/gnus/mm-decode-resources/win1252-multipart.bin b/test/lisp/gnus/mm-decode-resources/win1252-multipart.bin new file mode 100644 index 00000000000..d3c5026dcce --- /dev/null +++ b/test/lisp/gnus/mm-decode-resources/win1252-multipart.bin | |||
| @@ -0,0 +1,44 @@ | |||
| 1 | To: example <example@example.org> | ||
| 2 | From: example <example@example.org> | ||
| 3 | Date: Tue, 5 Jan 2021 10:30:34 +0100 | ||
| 4 | MIME-Version: 1.0 | ||
| 5 | Content-Type: multipart/mixed; boundary="------------FB569A4368539497CC91D1DC" | ||
| 6 | Content-Language: fr | ||
| 7 | Subject: test | ||
| 8 | |||
| 9 | --------------FB569A4368539497CC91D1DC | ||
| 10 | Content-Type: multipart/alternative; | ||
| 11 | boundary="------------61C81A7DC7592E4C6F856A85" | ||
| 12 | |||
| 13 | |||
| 14 | --------------61C81A7DC7592E4C6F856A85 | ||
| 15 | Content-Type: text/plain; charset=windows-1252; format=flowed | ||
| 16 | Content-Transfer-Encoding: 8bit | ||
| 17 | |||
| 18 | déjà raté | ||
| 19 | |||
| 20 | --------------61C81A7DC7592E4C6F856A85 | ||
| 21 | Content-Type: text/html; charset=windows-1252 | ||
| 22 | Content-Transfer-Encoding: 8bit | ||
| 23 | |||
| 24 | <html> | ||
| 25 | <head> | ||
| 26 | <meta http-equiv="content-type" content="text/html; charset=windows-1252"> | ||
| 27 | </head> | ||
| 28 | <body> | ||
| 29 | déjà raté | ||
| 30 | </body> | ||
| 31 | </html> | ||
| 32 | |||
| 33 | --------------61C81A7DC7592E4C6F856A85-- | ||
| 34 | |||
| 35 | --------------FB569A4368539497CC91D1DC | ||
| 36 | Content-Type: text/plain; charset="us-ascii" | ||
| 37 | MIME-Version: 1.0 | ||
| 38 | Content-Transfer-Encoding: 7bit | ||
| 39 | Content-Disposition: inline | ||
| 40 | |||
| 41 | mailing list signature | ||
| 42 | |||
| 43 | --------------FB569A4368539497CC91D1DC-- | ||
| 44 | |||
diff --git a/test/lisp/gnus/mm-decode-tests.el b/test/lisp/gnus/mm-decode-tests.el index 74591f919da..7d059cb3f87 100644 --- a/test/lisp/gnus/mm-decode-tests.el +++ b/test/lisp/gnus/mm-decode-tests.el | |||
| @@ -70,20 +70,33 @@ | |||
| 70 | 'charset))) | 70 | 'charset))) |
| 71 | "ääää\n")))))) | 71 | "ääää\n")))))) |
| 72 | 72 | ||
| 73 | (ert-deftest test-mm-with-part-multibyte () | 73 | (ert-deftest test-mm-dissect-buffer-win1252 () |
| 74 | (with-temp-buffer | 74 | (with-temp-buffer |
| 75 | (set-buffer-multibyte t) | 75 | (set-buffer-multibyte nil) |
| 76 | (nnheader-insert-file-contents (ert-resource-file "8bit-multipart.bin")) | 76 | (insert-file-contents-literally (ert-resource-file "win1252-multipart.bin")) |
| 77 | (while (search-forward "\r\n" nil t) | ||
| 78 | (replace-match "\n")) | ||
| 79 | (let ((handle (mm-dissect-buffer))) | 77 | (let ((handle (mm-dissect-buffer))) |
| 78 | (should (equal (mm-handle-media-type handle) "multipart/mixed")) | ||
| 79 | ;; Skip multipart type. | ||
| 80 | (pop handle) | ||
| 81 | (setq handle (car handle)) | ||
| 80 | (pop handle) | 82 | (pop handle) |
| 81 | (let ((part (pop handle))) | 83 | (let ((part (pop handle))) |
| 82 | (should (equal (decode-coding-string | 84 | (should (equal (mm-handle-media-type part) "text/plain")) |
| 83 | (mm-with-part part | 85 | (should (eq (mm-handle-encoding part) '8bit)) |
| 84 | (buffer-string)) | 86 | (with-current-buffer (mm-handle-buffer part) |
| 85 | (intern (mail-content-type-get (mm-handle-type part) | 87 | (should (equal (decode-coding-string |
| 86 | 'charset))) | 88 | (buffer-string) |
| 87 | "ääää\n")))))) | 89 | (intern (mail-content-type-get (mm-handle-type part) |
| 90 | 'charset))) | ||
| 91 | "déjà raté\n")))) | ||
| 92 | (let ((part (pop handle))) | ||
| 93 | (should (equal (mm-handle-media-type part) "text/html")) | ||
| 94 | (should (eq (mm-handle-encoding part) '8bit)) | ||
| 95 | (with-current-buffer (mm-handle-buffer part) | ||
| 96 | (should (equal (decode-coding-string | ||
| 97 | (buffer-string) | ||
| 98 | (intern (mail-content-type-get (mm-handle-type part) | ||
| 99 | 'charset))) | ||
| 100 | "<html>\n <head>\n <meta http-equiv=\"content-type\" content=\"text/html; charset=windows-1252\">\n </head>\n <body>\n déjà raté\n </body>\n</html>\n"))))))) | ||
| 88 | 101 | ||
| 89 | ;;; mm-decode-tests.el ends here | 102 | ;;; mm-decode-tests.el ends here |
diff --git a/test/lisp/help-mode-tests.el b/test/lisp/help-mode-tests.el index e0e82c9cc1a..43db59d4b1b 100644 --- a/test/lisp/help-mode-tests.el +++ b/test/lisp/help-mode-tests.el | |||
| @@ -72,14 +72,19 @@ Lisp concepts such as car, cdr, cons cell and list.") | |||
| 72 | #'info))))) | 72 | #'info))))) |
| 73 | 73 | ||
| 74 | (ert-deftest help-mode-tests-xref-button () | 74 | (ert-deftest help-mode-tests-xref-button () |
| 75 | (with-temp-buffer | 75 | (let* ((fmt "See also the function ‘%s’.") |
| 76 | (insert "See also the function ‘interactive’.") | 76 | ;; 1+ translates string index to buffer position. |
| 77 | (string-match help-xref-symbol-regexp (buffer-string)) | 77 | (beg (1+ (string-search "%" fmt)))) |
| 78 | (help-xref-button 8 'help-function) | 78 | (with-temp-buffer |
| 79 | (should-not (button-at 22)) | 79 | (dolist (fn '(interactive \` = + - * / %)) |
| 80 | (should-not (button-at 35)) | 80 | (erase-buffer) |
| 81 | (let ((button (button-at 30))) | 81 | (insert (format fmt fn)) |
| 82 | (should (eq (button-type button) 'help-function))))) | 82 | (goto-char (point-min)) |
| 83 | (re-search-forward help-xref-symbol-regexp) | ||
| 84 | (help-xref-button 8 'help-function) | ||
| 85 | (should-not (button-at (1- beg))) | ||
| 86 | (should-not (button-at (+ beg (length (symbol-name fn))))) | ||
| 87 | (should (eq (button-type (button-at beg)) 'help-function)))))) | ||
| 83 | 88 | ||
| 84 | (ert-deftest help-mode-tests-insert-xref-button () | 89 | (ert-deftest help-mode-tests-insert-xref-button () |
| 85 | (with-temp-buffer | 90 | (with-temp-buffer |
diff --git a/test/lisp/help-tests.el b/test/lisp/help-tests.el index 835d9fe7949..8034764741c 100644 --- a/test/lisp/help-tests.el +++ b/test/lisp/help-tests.el | |||
| @@ -95,7 +95,7 @@ | |||
| 95 | key binding | 95 | key binding |
| 96 | --- ------- | 96 | --- ------- |
| 97 | 97 | ||
| 98 | C-g abort-recursive-edit | 98 | C-g abort-minibuffers |
| 99 | TAB minibuffer-complete | 99 | TAB minibuffer-complete |
| 100 | C-j minibuffer-complete-and-exit | 100 | C-j minibuffer-complete-and-exit |
| 101 | RET minibuffer-complete-and-exit | 101 | RET minibuffer-complete-and-exit |
| @@ -122,7 +122,7 @@ M-s next-matching-history-element | |||
| 122 | 122 | ||
| 123 | (ert-deftest help-tests-substitute-command-keys/keymap-change () | 123 | (ert-deftest help-tests-substitute-command-keys/keymap-change () |
| 124 | (with-substitute-command-keys-test | 124 | (with-substitute-command-keys-test |
| 125 | (test "\\<minibuffer-local-must-match-map>\\[abort-recursive-edit]" "C-g") | 125 | (test "\\<minibuffer-local-must-match-map>\\[abort-recursive-edit]" "C-]") |
| 126 | (test "\\<emacs-lisp-mode-map>\\[eval-defun]" "C-M-x"))) | 126 | (test "\\<emacs-lisp-mode-map>\\[eval-defun]" "C-M-x"))) |
| 127 | 127 | ||
| 128 | (defvar help-tests-remap-map | 128 | (defvar help-tests-remap-map |
diff --git a/test/lisp/net/nsm-tests.el b/test/lisp/net/nsm-tests.el index 88c30c20395..ff453319b37 100644 --- a/test/lisp/net/nsm-tests.el +++ b/test/lisp/net/nsm-tests.el | |||
| @@ -49,15 +49,17 @@ | |||
| 49 | (should (eq nil (nsm-should-check "127.0.0.1"))) | 49 | (should (eq nil (nsm-should-check "127.0.0.1"))) |
| 50 | (should (eq nil (nsm-should-check "localhost")))))) | 50 | (should (eq nil (nsm-should-check "localhost")))))) |
| 51 | 51 | ||
| 52 | (defun nsm-ipv6-is-available () | 52 | ;; This will need updating when IANA assign more IPv6 global ranges. |
| 53 | (defun ipv6-is-available () | ||
| 53 | (and (featurep 'make-network-process '(:family ipv6)) | 54 | (and (featurep 'make-network-process '(:family ipv6)) |
| 54 | (cl-rassoc-if | 55 | (cl-rassoc-if |
| 55 | (lambda (elt) | 56 | (lambda (elt) |
| 56 | (eq 9 (length elt))) | 57 | (and (eq 9 (length elt)) |
| 58 | (= (logand (aref elt 0) #xe000) #x2000))) | ||
| 57 | (network-interface-list)))) | 59 | (network-interface-list)))) |
| 58 | 60 | ||
| 59 | (ert-deftest nsm-check-local-subnet-ipv6 () | 61 | (ert-deftest nsm-check-local-subnet-ipv6 () |
| 60 | (skip-unless (nsm-ipv6-is-available)) | 62 | (skip-unless (ipv6-is-available)) |
| 61 | (let ((local-ip '[123 456 789 11 172 26 128 160 0]) | 63 | (let ((local-ip '[123 456 789 11 172 26 128 160 0]) |
| 62 | (mask '[255 255 255 255 255 255 255 0 0]) | 64 | (mask '[255 255 255 255 255 255 255 0 0]) |
| 63 | 65 | ||
diff --git a/test/lisp/net/socks-tests.el b/test/lisp/net/socks-tests.el new file mode 100644 index 00000000000..b378ed2964e --- /dev/null +++ b/test/lisp/net/socks-tests.el | |||
| @@ -0,0 +1,103 @@ | |||
| 1 | ;;; socks-tests.el --- tests for SOCKS -*- coding: utf-8; lexical-binding: t; -*- | ||
| 2 | |||
| 3 | ;; Copyright (C) 2021 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 | ;;; Commentary: | ||
| 21 | |||
| 22 | ;;; Code: | ||
| 23 | |||
| 24 | (require 'socks) | ||
| 25 | (require 'url-http) | ||
| 26 | |||
| 27 | (defvar socks-tests-canned-server-port nil) | ||
| 28 | |||
| 29 | (defun socks-tests-canned-server-create (verbatim patterns) | ||
| 30 | "Create a fake SOCKS server and return the process. | ||
| 31 | |||
| 32 | `VERBATIM' and `PATTERNS' are dotted alists containing responses. | ||
| 33 | Requests are tried in order. On failure, an error is raised." | ||
| 34 | (let* ((buf (generate-new-buffer "*canned-socks-server*")) | ||
| 35 | (filt (lambda (proc line) | ||
| 36 | (let ((resp (or (assoc-default line verbatim | ||
| 37 | (lambda (k s) ; s is line | ||
| 38 | (string= (concat k) s))) | ||
| 39 | (assoc-default line patterns | ||
| 40 | (lambda (p s) | ||
| 41 | (string-match-p p s)))))) | ||
| 42 | (unless resp | ||
| 43 | (error "Unknown request: %s" line)) | ||
| 44 | (let ((print-escape-control-characters t)) | ||
| 45 | (princ (format "<- %s\n" (prin1-to-string line)) buf) | ||
| 46 | (princ (format "-> %s\n" (prin1-to-string resp)) buf)) | ||
| 47 | (process-send-string proc (concat resp))))) | ||
| 48 | (srv (make-network-process :server 1 | ||
| 49 | :buffer buf | ||
| 50 | :filter filt | ||
| 51 | :name "server" | ||
| 52 | :family 'ipv4 | ||
| 53 | :host 'local | ||
| 54 | :service socks-tests-canned-server-port))) | ||
| 55 | (set-process-query-on-exit-flag srv nil) | ||
| 56 | (princ (format "[%s] Listening on localhost:10080\n" srv) buf) | ||
| 57 | srv)) | ||
| 58 | |||
| 59 | ;; Add ([5 3 0 1 2] . [5 2]) to the `verbatim' list below to validate | ||
| 60 | ;; against curl 7.71 with the following options: | ||
| 61 | ;; $ curl --verbose -U foo:bar --proxy socks5h://127.0.0.1:10080 example.com | ||
| 62 | ;; | ||
| 63 | ;; If later implementing version 4a, try these: | ||
| 64 | ;; [4 1 0 80 0 0 0 1 0 ?e ?x ?a ?m ?p ?l ?e ?. ?c ?o ?m 0] . [0 90 0 0 0 0 0 0] | ||
| 65 | ;; $ curl --verbose --proxy socks4a://127.0.0.1:10080 example.com | ||
| 66 | |||
| 67 | (ert-deftest socks-tests-auth-filter-url-http () | ||
| 68 | "Verify correct handling of SOCKS5 user/pass authentication." | ||
| 69 | (let* ((socks-server '("server" "127.0.0.1" 10080 5)) | ||
| 70 | (socks-username "foo") | ||
| 71 | (socks-password "bar") | ||
| 72 | (url-gateway-method 'socks) | ||
| 73 | (url (url-generic-parse-url "http://example.com")) | ||
| 74 | (verbatim '(([5 2 0 2] . [5 2]) | ||
| 75 | ([1 3 ?f ?o ?o 3 ?b ?a ?r] . [1 0]) | ||
| 76 | ([5 1 0 3 11 ?e ?x ?a ?m ?p ?l ?e ?. ?c ?o ?m 0 80] | ||
| 77 | . [5 0 0 1 0 0 0 0 0 0]))) | ||
| 78 | (patterns | ||
| 79 | `(("^GET /" . ,(concat "HTTP/1.1 200 OK\r\n" | ||
| 80 | "Content-Type: text/plain; charset=UTF-8\r\n" | ||
| 81 | "Content-Length: 13\r\n\r\n" | ||
| 82 | "Hello World!\n")))) | ||
| 83 | (socks-tests-canned-server-port 10080) | ||
| 84 | (server (socks-tests-canned-server-create verbatim patterns)) | ||
| 85 | (tries 10) | ||
| 86 | ;; | ||
| 87 | done | ||
| 88 | ;; | ||
| 89 | (cb (lambda (&rest _r) | ||
| 90 | (goto-char (point-min)) | ||
| 91 | (should (search-forward "Hello World" nil t)) | ||
| 92 | (setq done t))) | ||
| 93 | (buf (url-http url cb '(nil)))) | ||
| 94 | (ert-info ("Connect to HTTP endpoint over SOCKS5 with USER/PASS method") | ||
| 95 | (while (and (not done) (< 0 (cl-decf tries))) ; cl-lib via url-http | ||
| 96 | (sleep-for 0.1))) | ||
| 97 | (should done) | ||
| 98 | (delete-process server) | ||
| 99 | (kill-buffer (process-buffer server)) | ||
| 100 | (kill-buffer buf) | ||
| 101 | (ignore url-gateway-method))) | ||
| 102 | |||
| 103 | ;;; socks-tests.el ends here | ||
diff --git a/test/lisp/net/tramp-tests.el b/test/lisp/net/tramp-tests.el index e1cb9939f29..ef0968a3385 100644 --- a/test/lisp/net/tramp-tests.el +++ b/test/lisp/net/tramp-tests.el | |||
| @@ -78,6 +78,8 @@ | |||
| 78 | ;; Needed for Emacs 27. | 78 | ;; Needed for Emacs 27. |
| 79 | (defvar process-file-return-signal-string) | 79 | (defvar process-file-return-signal-string) |
| 80 | (defvar shell-command-dont-erase-buffer) | 80 | (defvar shell-command-dont-erase-buffer) |
| 81 | ;; Needed for Emacs 28. | ||
| 82 | (defvar dired-copy-dereference) | ||
| 81 | 83 | ||
| 82 | ;; Beautify batch mode. | 84 | ;; Beautify batch mode. |
| 83 | (when noninteractive | 85 | (when noninteractive |
| @@ -98,7 +100,6 @@ | |||
| 98 | '("mock" | 100 | '("mock" |
| 99 | (tramp-login-program "sh") | 101 | (tramp-login-program "sh") |
| 100 | (tramp-login-args (("-i"))) | 102 | (tramp-login-args (("-i"))) |
| 101 | (tramp-direct-async-args (("-c"))) | ||
| 102 | (tramp-remote-shell "/bin/sh") | 103 | (tramp-remote-shell "/bin/sh") |
| 103 | (tramp-remote-shell-args ("-c")) | 104 | (tramp-remote-shell-args ("-c")) |
| 104 | (tramp-connection-timeout 10))) | 105 | (tramp-connection-timeout 10))) |
| @@ -2438,7 +2439,7 @@ This checks also `file-name-as-directory', `file-name-directory', | |||
| 2438 | ;; We must check the last line. There could be | 2439 | ;; We must check the last line. There could be |
| 2439 | ;; other messages from the progress reporter. | 2440 | ;; other messages from the progress reporter. |
| 2440 | (should | 2441 | (should |
| 2441 | (string-match | 2442 | (string-match-p |
| 2442 | (if (and (null noninteractive) | 2443 | (if (and (null noninteractive) |
| 2443 | (or (eq visit t) (null visit) (stringp visit))) | 2444 | (or (eq visit t) (null visit) (stringp visit))) |
| 2444 | (format "^Wrote %s\n\\'" (regexp-quote tmp-name)) | 2445 | (format "^Wrote %s\n\\'" (regexp-quote tmp-name)) |
| @@ -2833,6 +2834,7 @@ This tests also `file-directory-p' and `file-accessible-directory-p'." | |||
| 2833 | (ert-deftest tramp-test15-copy-directory () | 2834 | (ert-deftest tramp-test15-copy-directory () |
| 2834 | "Check `copy-directory'." | 2835 | "Check `copy-directory'." |
| 2835 | (skip-unless (tramp--test-enabled)) | 2836 | (skip-unless (tramp--test-enabled)) |
| 2837 | (skip-unless (or (tramp--test-emacs26-p) (not (tramp--test-rclone-p)))) | ||
| 2836 | 2838 | ||
| 2837 | (dolist (quoted (if (tramp--test-expensive-test) '(nil t) '(nil))) | 2839 | (dolist (quoted (if (tramp--test-expensive-test) '(nil t) '(nil))) |
| 2838 | (let* ((tmp-name1 (tramp--test-make-temp-name nil quoted)) | 2840 | (let* ((tmp-name1 (tramp--test-make-temp-name nil quoted)) |
| @@ -3067,9 +3069,7 @@ This tests also `file-directory-p' and `file-accessible-directory-p'." | |||
| 3067 | (regexp-opt (directory-files tmp-name1)) | 3069 | (regexp-opt (directory-files tmp-name1)) |
| 3068 | (length (directory-files tmp-name1))))))) | 3070 | (length (directory-files tmp-name1))))))) |
| 3069 | 3071 | ||
| 3070 | ;; Check error case. We do not check for the error type, | 3072 | ;; Check error case. |
| 3071 | ;; because ls-lisp returns `file-error', and native Tramp | ||
| 3072 | ;; returns `file-missing'. | ||
| 3073 | (delete-directory tmp-name1 'recursive) | 3073 | (delete-directory tmp-name1 'recursive) |
| 3074 | (with-temp-buffer | 3074 | (with-temp-buffer |
| 3075 | (should-error | 3075 | (should-error |
| @@ -3188,6 +3188,59 @@ This tests also `file-directory-p' and `file-accessible-directory-p'." | |||
| 3188 | (ignore-errors (delete-directory tmp-name1 'recursive)) | 3188 | (ignore-errors (delete-directory tmp-name1 'recursive)) |
| 3189 | (ignore-errors (delete-directory tmp-name2 'recursive)))))) | 3189 | (ignore-errors (delete-directory tmp-name2 'recursive)))))) |
| 3190 | 3190 | ||
| 3191 | ;; The following test is inspired by Bug#45691. | ||
| 3192 | (ert-deftest tramp-test17-insert-directory-one-file () | ||
| 3193 | "Check `insert-directory' inside directory listing." | ||
| 3194 | (skip-unless (tramp--test-enabled)) | ||
| 3195 | |||
| 3196 | (dolist (quoted (if (tramp--test-expensive-test) '(nil t) '(nil))) | ||
| 3197 | (let* ((tmp-name1 | ||
| 3198 | (expand-file-name (tramp--test-make-temp-name nil quoted))) | ||
| 3199 | (tmp-name2 (expand-file-name "foo" tmp-name1)) | ||
| 3200 | (tmp-name3 (expand-file-name "bar" tmp-name1)) | ||
| 3201 | (dired-copy-preserve-time t) | ||
| 3202 | (dired-recursive-copies 'top) | ||
| 3203 | dired-copy-dereference | ||
| 3204 | buffer) | ||
| 3205 | (unwind-protect | ||
| 3206 | (progn | ||
| 3207 | (make-directory tmp-name1) | ||
| 3208 | (write-region "foo" nil tmp-name2) | ||
| 3209 | (should (file-directory-p tmp-name1)) | ||
| 3210 | (should (file-exists-p tmp-name2)) | ||
| 3211 | |||
| 3212 | ;; Check, that `insert-directory' works properly. | ||
| 3213 | (with-current-buffer | ||
| 3214 | (setq buffer (dired-noselect tmp-name1 "--dired -al")) | ||
| 3215 | (read-only-mode -1) | ||
| 3216 | (goto-char (point-min)) | ||
| 3217 | (while (not (or (eobp) | ||
| 3218 | (string-equal | ||
| 3219 | (dired-get-filename 'localp 'no-error) | ||
| 3220 | (file-name-nondirectory tmp-name2)))) | ||
| 3221 | (forward-line 1)) | ||
| 3222 | (should-not (eobp)) | ||
| 3223 | (copy-file tmp-name2 tmp-name3) | ||
| 3224 | (insert-directory | ||
| 3225 | (file-name-nondirectory tmp-name3) "--dired -al -d") | ||
| 3226 | ;; Point shall still be the recent file. | ||
| 3227 | (should | ||
| 3228 | (string-equal | ||
| 3229 | (dired-get-filename 'localp 'no-error) | ||
| 3230 | (file-name-nondirectory tmp-name2))) | ||
| 3231 | (should-not (re-search-forward "dired" nil t)) | ||
| 3232 | ;; The copied file has been inserted the line before. | ||
| 3233 | (forward-line -1) | ||
| 3234 | (should | ||
| 3235 | (string-equal | ||
| 3236 | (dired-get-filename 'localp 'no-error) | ||
| 3237 | (file-name-nondirectory tmp-name3)))) | ||
| 3238 | (kill-buffer buffer)) | ||
| 3239 | |||
| 3240 | ;; Cleanup. | ||
| 3241 | (ignore-errors (kill-buffer buffer)) | ||
| 3242 | (ignore-errors (delete-directory tmp-name1 'recursive)))))) | ||
| 3243 | |||
| 3191 | ;; Method "smb" supports `make-symbolic-link' only if the remote host | 3244 | ;; Method "smb" supports `make-symbolic-link' only if the remote host |
| 3192 | ;; has CIFS capabilities. tramp-adb.el, tramp-gvfs.el and | 3245 | ;; has CIFS capabilities. tramp-adb.el, tramp-gvfs.el and |
| 3193 | ;; tramp-rclone.el do not support symbolic links at all. | 3246 | ;; tramp-rclone.el do not support symbolic links at all. |
| @@ -3561,8 +3614,8 @@ This tests also `file-executable-p', `file-writable-p' and `set-file-modes'." | |||
| 3561 | `(condition-case err | 3614 | `(condition-case err |
| 3562 | (progn ,@body) | 3615 | (progn ,@body) |
| 3563 | (file-error | 3616 | (file-error |
| 3564 | (unless (string-match "^error with add-name-to-file" | 3617 | (unless (string-match-p "^error with add-name-to-file" |
| 3565 | (error-message-string err)) | 3618 | (error-message-string err)) |
| 3566 | (signal (car err) (cdr err)))))) | 3619 | (signal (car err) (cdr err)))))) |
| 3567 | 3620 | ||
| 3568 | (ert-deftest tramp-test21-file-links () | 3621 | (ert-deftest tramp-test21-file-links () |
| @@ -4337,7 +4390,7 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'." | |||
| 4337 | ;; there's an indication for a signal describing string. | 4390 | ;; there's an indication for a signal describing string. |
| 4338 | (let ((process-file-return-signal-string t)) | 4391 | (let ((process-file-return-signal-string t)) |
| 4339 | (should | 4392 | (should |
| 4340 | (string-match | 4393 | (string-match-p |
| 4341 | "Interrupt\\|Signal 2" | 4394 | "Interrupt\\|Signal 2" |
| 4342 | (process-file | 4395 | (process-file |
| 4343 | (if (tramp--test-adb-p) "/system/bin/sh" "/bin/sh") | 4396 | (if (tramp--test-adb-p) "/system/bin/sh" "/bin/sh") |
| @@ -4405,7 +4458,7 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'." | |||
| 4405 | (with-timeout (10 (tramp--test-timeout-handler)) | 4458 | (with-timeout (10 (tramp--test-timeout-handler)) |
| 4406 | (while (< (- (point-max) (point-min)) (length "foo")) | 4459 | (while (< (- (point-max) (point-min)) (length "foo")) |
| 4407 | (while (accept-process-output proc 0 nil t)))) | 4460 | (while (accept-process-output proc 0 nil t)))) |
| 4408 | (should (string-match "foo" (buffer-string)))) | 4461 | (should (string-match-p "foo" (buffer-string)))) |
| 4409 | 4462 | ||
| 4410 | ;; Cleanup. | 4463 | ;; Cleanup. |
| 4411 | (ignore-errors (delete-process proc))) | 4464 | (ignore-errors (delete-process proc))) |
| @@ -4424,7 +4477,7 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'." | |||
| 4424 | (with-timeout (10 (tramp--test-timeout-handler)) | 4477 | (with-timeout (10 (tramp--test-timeout-handler)) |
| 4425 | (while (< (- (point-max) (point-min)) (length "foo")) | 4478 | (while (< (- (point-max) (point-min)) (length "foo")) |
| 4426 | (while (accept-process-output proc 0 nil t)))) | 4479 | (while (accept-process-output proc 0 nil t)))) |
| 4427 | (should (string-match "foo" (buffer-string)))) | 4480 | (should (string-match-p "foo" (buffer-string)))) |
| 4428 | 4481 | ||
| 4429 | ;; Cleanup. | 4482 | ;; Cleanup. |
| 4430 | (ignore-errors | 4483 | (ignore-errors |
| @@ -4446,7 +4499,7 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'." | |||
| 4446 | (with-timeout (10 (tramp--test-timeout-handler)) | 4499 | (with-timeout (10 (tramp--test-timeout-handler)) |
| 4447 | (while (< (- (point-max) (point-min)) (length "foo")) | 4500 | (while (< (- (point-max) (point-min)) (length "foo")) |
| 4448 | (while (accept-process-output proc 0 nil t)))) | 4501 | (while (accept-process-output proc 0 nil t)))) |
| 4449 | (should (string-match "foo" (buffer-string)))) | 4502 | (should (string-match-p "foo" (buffer-string)))) |
| 4450 | 4503 | ||
| 4451 | ;; Cleanup. | 4504 | ;; Cleanup. |
| 4452 | (ignore-errors (delete-process proc))) | 4505 | (ignore-errors (delete-process proc))) |
| @@ -4488,8 +4541,6 @@ If UNSTABLE is non-nil, the test is tagged as `:unstable'." | |||
| 4488 | (cons '(nil "direct-async-process" t) | 4541 | (cons '(nil "direct-async-process" t) |
| 4489 | tramp-connection-properties))) | 4542 | tramp-connection-properties))) |
| 4490 | (skip-unless (tramp-direct-async-process-p)) | 4543 | (skip-unless (tramp-direct-async-process-p)) |
| 4491 | ;; For whatever reason, it doesn't cooperate with the "mock" method. | ||
| 4492 | (skip-unless (not (tramp--test-mock-p))) | ||
| 4493 | ;; We do expect an established connection already, | 4544 | ;; We do expect an established connection already, |
| 4494 | ;; `file-truename' does it by side-effect. Suppress | 4545 | ;; `file-truename' does it by side-effect. Suppress |
| 4495 | ;; `tramp--test-enabled', in order to keep the connection. | 4546 | ;; `tramp--test-enabled', in order to keep the connection. |
| @@ -4535,7 +4586,7 @@ If UNSTABLE is non-nil, the test is tagged as `:unstable'." | |||
| 4535 | (with-timeout (10 (tramp--test-timeout-handler)) | 4586 | (with-timeout (10 (tramp--test-timeout-handler)) |
| 4536 | (while (< (- (point-max) (point-min)) (length "foo")) | 4587 | (while (< (- (point-max) (point-min)) (length "foo")) |
| 4537 | (while (accept-process-output proc 0 nil t)))) | 4588 | (while (accept-process-output proc 0 nil t)))) |
| 4538 | (should (string-match "foo" (buffer-string)))) | 4589 | (should (string-match-p "foo" (buffer-string)))) |
| 4539 | 4590 | ||
| 4540 | ;; Cleanup. | 4591 | ;; Cleanup. |
| 4541 | (ignore-errors (delete-process proc))) | 4592 | (ignore-errors (delete-process proc))) |
| @@ -4556,7 +4607,7 @@ If UNSTABLE is non-nil, the test is tagged as `:unstable'." | |||
| 4556 | (with-timeout (10 (tramp--test-timeout-handler)) | 4607 | (with-timeout (10 (tramp--test-timeout-handler)) |
| 4557 | (while (< (- (point-max) (point-min)) (length "foo")) | 4608 | (while (< (- (point-max) (point-min)) (length "foo")) |
| 4558 | (while (accept-process-output proc 0 nil t)))) | 4609 | (while (accept-process-output proc 0 nil t)))) |
| 4559 | (should (string-match "foo" (buffer-string)))) | 4610 | (should (string-match-p "foo" (buffer-string)))) |
| 4560 | 4611 | ||
| 4561 | ;; Cleanup. | 4612 | ;; Cleanup. |
| 4562 | (ignore-errors | 4613 | (ignore-errors |
| @@ -4580,9 +4631,9 @@ If UNSTABLE is non-nil, the test is tagged as `:unstable'." | |||
| 4580 | (process-send-eof proc) | 4631 | (process-send-eof proc) |
| 4581 | ;; Read output. | 4632 | ;; Read output. |
| 4582 | (with-timeout (10 (tramp--test-timeout-handler)) | 4633 | (with-timeout (10 (tramp--test-timeout-handler)) |
| 4583 | (while (not (string-match "foo" (buffer-string))) | 4634 | (while (not (string-match-p "foo" (buffer-string))) |
| 4584 | (while (accept-process-output proc 0 nil t)))) | 4635 | (while (accept-process-output proc 0 nil t)))) |
| 4585 | (should (string-match "foo" (buffer-string)))) | 4636 | (should (string-match-p "foo" (buffer-string)))) |
| 4586 | 4637 | ||
| 4587 | ;; Cleanup. | 4638 | ;; Cleanup. |
| 4588 | (ignore-errors (delete-process proc))) | 4639 | (ignore-errors (delete-process proc))) |
| @@ -4607,7 +4658,7 @@ If UNSTABLE is non-nil, the test is tagged as `:unstable'." | |||
| 4607 | (with-timeout (10 (tramp--test-timeout-handler)) | 4658 | (with-timeout (10 (tramp--test-timeout-handler)) |
| 4608 | (while (accept-process-output proc 0 nil t))) | 4659 | (while (accept-process-output proc 0 nil t))) |
| 4609 | ;; On some MS Windows systems, it returns "unknown signal". | 4660 | ;; On some MS Windows systems, it returns "unknown signal". |
| 4610 | (should (string-match "unknown signal\\|killed" (buffer-string)))) | 4661 | (should (string-match-p "unknown signal\\|killed" (buffer-string)))) |
| 4611 | 4662 | ||
| 4612 | ;; Cleanup. | 4663 | ;; Cleanup. |
| 4613 | (ignore-errors (delete-process proc))) | 4664 | (ignore-errors (delete-process proc))) |
| @@ -4631,7 +4682,7 @@ If UNSTABLE is non-nil, the test is tagged as `:unstable'." | |||
| 4631 | (delete-process proc) | 4682 | (delete-process proc) |
| 4632 | (with-current-buffer stderr | 4683 | (with-current-buffer stderr |
| 4633 | (should | 4684 | (should |
| 4634 | (string-match | 4685 | (string-match-p |
| 4635 | "cat:.* No such file or directory" (buffer-string))))) | 4686 | "cat:.* No such file or directory" (buffer-string))))) |
| 4636 | 4687 | ||
| 4637 | ;; Cleanup. | 4688 | ;; Cleanup. |
| @@ -4658,7 +4709,7 @@ If UNSTABLE is non-nil, the test is tagged as `:unstable'." | |||
| 4658 | (with-temp-buffer | 4709 | (with-temp-buffer |
| 4659 | (insert-file-contents tmpfile) | 4710 | (insert-file-contents tmpfile) |
| 4660 | (should | 4711 | (should |
| 4661 | (string-match | 4712 | (string-match-p |
| 4662 | "cat:.* No such file or directory" (buffer-string))))) | 4713 | "cat:.* No such file or directory" (buffer-string))))) |
| 4663 | 4714 | ||
| 4664 | ;; Cleanup. | 4715 | ;; Cleanup. |
| @@ -4801,7 +4852,7 @@ INPUT, if non-nil, is a string sent to the process." | |||
| 4801 | (should | 4852 | (should |
| 4802 | (string-equal | 4853 | (string-equal |
| 4803 | ;; tramp-adb.el echoes, so we must add the string. | 4854 | ;; tramp-adb.el echoes, so we must add the string. |
| 4804 | (if (tramp--test-adb-p) | 4855 | (if (and (tramp--test-adb-p) (not (tramp-direct-async-process-p))) |
| 4805 | (format | 4856 | (format |
| 4806 | "%s\n%s\n" | 4857 | "%s\n%s\n" |
| 4807 | (file-name-nondirectory tmp-name) | 4858 | (file-name-nondirectory tmp-name) |
| @@ -4992,7 +5043,7 @@ INPUT, if non-nil, is a string sent to the process." | |||
| 4992 | (cons (concat envvar "=foo") process-environment))) | 5043 | (cons (concat envvar "=foo") process-environment))) |
| 4993 | ;; Default value. | 5044 | ;; Default value. |
| 4994 | (should | 5045 | (should |
| 4995 | (string-match | 5046 | (string-match-p |
| 4996 | "foo" | 5047 | "foo" |
| 4997 | (funcall | 5048 | (funcall |
| 4998 | this-shell-command-to-string | 5049 | this-shell-command-to-string |
| @@ -5003,13 +5054,13 @@ INPUT, if non-nil, is a string sent to the process." | |||
| 5003 | (cons (concat envvar "=") process-environment))) | 5054 | (cons (concat envvar "=") process-environment))) |
| 5004 | ;; Value is null. | 5055 | ;; Value is null. |
| 5005 | (should | 5056 | (should |
| 5006 | (string-match | 5057 | (string-match-p |
| 5007 | "bla" | 5058 | "bla" |
| 5008 | (funcall | 5059 | (funcall |
| 5009 | this-shell-command-to-string (format "echo \"${%s:-bla}\"" envvar)))) | 5060 | this-shell-command-to-string (format "echo \"${%s:-bla}\"" envvar)))) |
| 5010 | ;; Variable is set. | 5061 | ;; Variable is set. |
| 5011 | (should | 5062 | (should |
| 5012 | (string-match | 5063 | (string-match-p |
| 5013 | (regexp-quote envvar) | 5064 | (regexp-quote envvar) |
| 5014 | (funcall this-shell-command-to-string "set")))) | 5065 | (funcall this-shell-command-to-string "set")))) |
| 5015 | 5066 | ||
| @@ -5021,7 +5072,7 @@ INPUT, if non-nil, is a string sent to the process." | |||
| 5021 | (cons (concat envvar "=foo") tramp-remote-process-environment))) | 5072 | (cons (concat envvar "=foo") tramp-remote-process-environment))) |
| 5022 | ;; Set the initial value, we want to unset below. | 5073 | ;; Set the initial value, we want to unset below. |
| 5023 | (should | 5074 | (should |
| 5024 | (string-match | 5075 | (string-match-p |
| 5025 | "foo" | 5076 | "foo" |
| 5026 | (funcall | 5077 | (funcall |
| 5027 | this-shell-command-to-string | 5078 | this-shell-command-to-string |
| @@ -5029,14 +5080,14 @@ INPUT, if non-nil, is a string sent to the process." | |||
| 5029 | (let ((process-environment (cons envvar process-environment))) | 5080 | (let ((process-environment (cons envvar process-environment))) |
| 5030 | ;; Variable is unset. | 5081 | ;; Variable is unset. |
| 5031 | (should | 5082 | (should |
| 5032 | (string-match | 5083 | (string-match-p |
| 5033 | "bla" | 5084 | "bla" |
| 5034 | (funcall | 5085 | (funcall |
| 5035 | this-shell-command-to-string | 5086 | this-shell-command-to-string |
| 5036 | (format "echo \"${%s:-bla}\"" envvar)))) | 5087 | (format "echo \"${%s:-bla}\"" envvar)))) |
| 5037 | ;; Variable is unset. | 5088 | ;; Variable is unset. |
| 5038 | (should-not | 5089 | (should-not |
| 5039 | (string-match | 5090 | (string-match-p |
| 5040 | (regexp-quote envvar) | 5091 | (regexp-quote envvar) |
| 5041 | ;; We must remove PS1, the output is truncated otherwise. | 5092 | ;; We must remove PS1, the output is truncated otherwise. |
| 5042 | (funcall | 5093 | (funcall |
| @@ -5074,7 +5125,7 @@ Use direct async.") | |||
| 5074 | (format "%s=%d" envvar port) | 5125 | (format "%s=%d" envvar port) |
| 5075 | tramp-remote-process-environment))) | 5126 | tramp-remote-process-environment))) |
| 5076 | (should | 5127 | (should |
| 5077 | (string-match | 5128 | (string-match-p |
| 5078 | (number-to-string port) | 5129 | (number-to-string port) |
| 5079 | (shell-command-to-string (format "echo $%s" envvar)))))) | 5130 | (shell-command-to-string (format "echo $%s" envvar)))))) |
| 5080 | 5131 | ||
| @@ -5202,7 +5253,7 @@ Use direct async.") | |||
| 5202 | (with-timeout (10) | 5253 | (with-timeout (10) |
| 5203 | (while (accept-process-output | 5254 | (while (accept-process-output |
| 5204 | (get-buffer-process (current-buffer)) nil nil t))) | 5255 | (get-buffer-process (current-buffer)) nil nil t))) |
| 5205 | (should (string-match "^foo$" (buffer-string))))) | 5256 | (should (string-match-p "^foo$" (buffer-string))))) |
| 5206 | 5257 | ||
| 5207 | ;; Cleanup. | 5258 | ;; Cleanup. |
| 5208 | (put 'explicit-shell-file-name 'permanent-local nil) | 5259 | (put 'explicit-shell-file-name 'permanent-local nil) |
| @@ -5337,25 +5388,27 @@ Use direct async.") | |||
| 5337 | (tramp-remote-process-environment tramp-remote-process-environment) | 5388 | (tramp-remote-process-environment tramp-remote-process-environment) |
| 5338 | (inhibit-message t) | 5389 | (inhibit-message t) |
| 5339 | (vc-handled-backends | 5390 | (vc-handled-backends |
| 5340 | (with-parsed-tramp-file-name tramp-test-temporary-file-directory nil | 5391 | (cond |
| 5341 | (cond | 5392 | ((tramp-find-executable |
| 5342 | ((tramp-find-executable | 5393 | tramp-test-vec vc-git-program |
| 5343 | v vc-git-program (tramp-get-remote-path v)) | 5394 | (tramp-get-remote-path tramp-test-vec)) |
| 5344 | '(Git)) | 5395 | '(Git)) |
| 5345 | ((tramp-find-executable | 5396 | ((tramp-find-executable |
| 5346 | v vc-hg-program (tramp-get-remote-path v)) | 5397 | tramp-test-vec vc-hg-program |
| 5347 | '(Hg)) | 5398 | (tramp-get-remote-path tramp-test-vec)) |
| 5348 | ((tramp-find-executable | 5399 | '(Hg)) |
| 5349 | v vc-bzr-program (tramp-get-remote-path v)) | 5400 | ((tramp-find-executable |
| 5350 | (setq tramp-remote-process-environment | 5401 | tramp-test-vec vc-bzr-program |
| 5351 | (cons (format "BZR_HOME=%s" | 5402 | (tramp-get-remote-path tramp-test-vec)) |
| 5352 | (file-remote-p tmp-name1 'localname)) | 5403 | (setq tramp-remote-process-environment |
| 5353 | tramp-remote-process-environment)) | 5404 | (cons (format "BZR_HOME=%s" |
| 5354 | ;; We must force a reconnect, in order to activate $BZR_HOME. | 5405 | (file-remote-p tmp-name1 'localname)) |
| 5355 | (tramp-cleanup-connection | 5406 | tramp-remote-process-environment)) |
| 5356 | tramp-test-vec 'keep-debug 'keep-password) | 5407 | ;; We must force a reconnect, in order to activate $BZR_HOME. |
| 5357 | '(Bzr)) | 5408 | (tramp-cleanup-connection |
| 5358 | (t nil)))) | 5409 | tramp-test-vec 'keep-debug 'keep-password) |
| 5410 | '(Bzr)) | ||
| 5411 | (t nil))) | ||
| 5359 | ;; Suppress nasty messages. | 5412 | ;; Suppress nasty messages. |
| 5360 | (inhibit-message t)) | 5413 | (inhibit-message t)) |
| 5361 | (skip-unless vc-handled-backends) | 5414 | (skip-unless vc-handled-backends) |
| @@ -5681,7 +5734,7 @@ This does not support some special file names." | |||
| 5681 | "Check, whether an FTP-like method is used. | 5734 | "Check, whether an FTP-like method is used. |
| 5682 | This does not support globbing characters in file names (yet)." | 5735 | This does not support globbing characters in file names (yet)." |
| 5683 | ;; Globbing characters are ??, ?* and ?\[. | 5736 | ;; Globbing characters are ??, ?* and ?\[. |
| 5684 | (string-match | 5737 | (string-match-p |
| 5685 | "ftp$" (file-remote-p tramp-test-temporary-file-directory 'method))) | 5738 | "ftp$" (file-remote-p tramp-test-temporary-file-directory 'method))) |
| 5686 | 5739 | ||
| 5687 | (defun tramp--test-gvfs-p (&optional method) | 5740 | (defun tramp--test-gvfs-p (&optional method) |
| @@ -5695,18 +5748,18 @@ If optional METHOD is given, it is checked first." | |||
| 5695 | "Check, whether the remote host runs HP-UX. | 5748 | "Check, whether the remote host runs HP-UX. |
| 5696 | Several special characters do not work properly there." | 5749 | Several special characters do not work properly there." |
| 5697 | ;; We must refill the cache. `file-truename' does it. | 5750 | ;; We must refill the cache. `file-truename' does it. |
| 5698 | (with-parsed-tramp-file-name | 5751 | (file-truename tramp-test-temporary-file-directory) nil |
| 5699 | (file-truename tramp-test-temporary-file-directory) nil | 5752 | (string-match-p |
| 5700 | (string-match "^HP-UX" (tramp-get-connection-property v "uname" "")))) | 5753 | "^HP-UX" (tramp-get-connection-property tramp-test-vec "uname" ""))) |
| 5701 | 5754 | ||
| 5702 | (defun tramp--test-ksh-p () | 5755 | (defun tramp--test-ksh-p () |
| 5703 | "Check, whether the remote shell is ksh. | 5756 | "Check, whether the remote shell is ksh. |
| 5704 | ksh93 makes some strange conversions of non-latin characters into | 5757 | ksh93 makes some strange conversions of non-latin characters into |
| 5705 | a $'' syntax." | 5758 | a $'' syntax." |
| 5706 | ;; We must refill the cache. `file-truename' does it. | 5759 | ;; We must refill the cache. `file-truename' does it. |
| 5707 | (with-parsed-tramp-file-name | 5760 | (file-truename tramp-test-temporary-file-directory) nil |
| 5708 | (file-truename tramp-test-temporary-file-directory) nil | 5761 | (string-match-p |
| 5709 | (string-match "ksh$" (tramp-get-connection-property v "remote-shell" "")))) | 5762 | "ksh$" (tramp-get-connection-property tramp-test-vec "remote-shell" ""))) |
| 5710 | 5763 | ||
| 5711 | (defun tramp--test-mock-p () | 5764 | (defun tramp--test-mock-p () |
| 5712 | "Check, whether the mock method is used. | 5765 | "Check, whether the mock method is used. |
| @@ -5758,7 +5811,7 @@ This does not support special characters." | |||
| 5758 | "Check, whether the locale host runs MS Windows, and ps{cp,ftp} is used. | 5811 | "Check, whether the locale host runs MS Windows, and ps{cp,ftp} is used. |
| 5759 | This does not support utf8 based file transfer." | 5812 | This does not support utf8 based file transfer." |
| 5760 | (and (eq system-type 'windows-nt) | 5813 | (and (eq system-type 'windows-nt) |
| 5761 | (string-match | 5814 | (string-match-p |
| 5762 | (regexp-opt '("pscp" "psftp")) | 5815 | (regexp-opt '("pscp" "psftp")) |
| 5763 | (file-remote-p tramp-test-temporary-file-directory 'method)))) | 5816 | (file-remote-p tramp-test-temporary-file-directory 'method)))) |
| 5764 | 5817 | ||
| @@ -6021,6 +6074,7 @@ This requires restrictions of file name syntax." | |||
| 6021 | (skip-unless (tramp--test-enabled)) | 6074 | (skip-unless (tramp--test-enabled)) |
| 6022 | (skip-unless (not (tramp--test-rsync-p))) | 6075 | (skip-unless (not (tramp--test-rsync-p))) |
| 6023 | (skip-unless (not (tramp--test-windows-nt-and-pscp-psftp-p))) | 6076 | (skip-unless (not (tramp--test-windows-nt-and-pscp-psftp-p))) |
| 6077 | (skip-unless (or (tramp--test-emacs26-p) (not (tramp--test-rclone-p)))) | ||
| 6024 | 6078 | ||
| 6025 | (tramp--test-special-characters)) | 6079 | (tramp--test-special-characters)) |
| 6026 | 6080 | ||
| @@ -6032,6 +6086,8 @@ Use the `stat' command." | |||
| 6032 | (skip-unless (tramp--test-sh-p)) | 6086 | (skip-unless (tramp--test-sh-p)) |
| 6033 | (skip-unless (not (tramp--test-rsync-p))) | 6087 | (skip-unless (not (tramp--test-rsync-p))) |
| 6034 | (skip-unless (not (tramp--test-windows-nt-and-pscp-psftp-p))) | 6088 | (skip-unless (not (tramp--test-windows-nt-and-pscp-psftp-p))) |
| 6089 | (skip-unless (or (tramp--test-emacs26-p) (not (tramp--test-rclone-p)))) | ||
| 6090 | ;; We cannot use `tramp-test-vec', because this fails during compilation. | ||
| 6035 | (with-parsed-tramp-file-name tramp-test-temporary-file-directory nil | 6091 | (with-parsed-tramp-file-name tramp-test-temporary-file-directory nil |
| 6036 | (skip-unless (tramp-get-remote-stat v))) | 6092 | (skip-unless (tramp-get-remote-stat v))) |
| 6037 | 6093 | ||
| @@ -6050,6 +6106,8 @@ Use the `perl' command." | |||
| 6050 | (skip-unless (tramp--test-sh-p)) | 6106 | (skip-unless (tramp--test-sh-p)) |
| 6051 | (skip-unless (not (tramp--test-rsync-p))) | 6107 | (skip-unless (not (tramp--test-rsync-p))) |
| 6052 | (skip-unless (not (tramp--test-windows-nt-and-pscp-psftp-p))) | 6108 | (skip-unless (not (tramp--test-windows-nt-and-pscp-psftp-p))) |
| 6109 | (skip-unless (or (tramp--test-emacs26-p) (not (tramp--test-rclone-p)))) | ||
| 6110 | ;; We cannot use `tramp-test-vec', because this fails during compilation. | ||
| 6053 | (with-parsed-tramp-file-name tramp-test-temporary-file-directory nil | 6111 | (with-parsed-tramp-file-name tramp-test-temporary-file-directory nil |
| 6054 | (skip-unless (tramp-get-remote-perl v))) | 6112 | (skip-unless (tramp-get-remote-perl v))) |
| 6055 | 6113 | ||
| @@ -6072,6 +6130,7 @@ Use the `ls' command." | |||
| 6072 | (skip-unless (not (tramp--test-rsync-p))) | 6130 | (skip-unless (not (tramp--test-rsync-p))) |
| 6073 | (skip-unless (not (tramp--test-windows-nt-and-batch-p))) | 6131 | (skip-unless (not (tramp--test-windows-nt-and-batch-p))) |
| 6074 | (skip-unless (not (tramp--test-windows-nt-and-pscp-psftp-p))) | 6132 | (skip-unless (not (tramp--test-windows-nt-and-pscp-psftp-p))) |
| 6133 | (skip-unless (or (tramp--test-emacs26-p) (not (tramp--test-rclone-p)))) | ||
| 6075 | 6134 | ||
| 6076 | (let ((tramp-connection-properties | 6135 | (let ((tramp-connection-properties |
| 6077 | (append | 6136 | (append |
| @@ -6140,6 +6199,7 @@ Use the `ls' command." | |||
| 6140 | (skip-unless (not (tramp--test-windows-nt-and-pscp-psftp-p))) | 6199 | (skip-unless (not (tramp--test-windows-nt-and-pscp-psftp-p))) |
| 6141 | (skip-unless (not (tramp--test-ksh-p))) | 6200 | (skip-unless (not (tramp--test-ksh-p))) |
| 6142 | (skip-unless (not (tramp--test-crypt-p))) | 6201 | (skip-unless (not (tramp--test-crypt-p))) |
| 6202 | (skip-unless (or (tramp--test-emacs26-p) (not (tramp--test-rclone-p)))) | ||
| 6143 | 6203 | ||
| 6144 | (tramp--test-utf8)) | 6204 | (tramp--test-utf8)) |
| 6145 | 6205 | ||
| @@ -6155,6 +6215,8 @@ Use the `stat' command." | |||
| 6155 | (skip-unless (not (tramp--test-windows-nt-and-pscp-psftp-p))) | 6215 | (skip-unless (not (tramp--test-windows-nt-and-pscp-psftp-p))) |
| 6156 | (skip-unless (not (tramp--test-ksh-p))) | 6216 | (skip-unless (not (tramp--test-ksh-p))) |
| 6157 | (skip-unless (not (tramp--test-crypt-p))) | 6217 | (skip-unless (not (tramp--test-crypt-p))) |
| 6218 | (skip-unless (or (tramp--test-emacs26-p) (not (tramp--test-rclone-p)))) | ||
| 6219 | ;; We cannot use `tramp-test-vec', because this fails during compilation. | ||
| 6158 | (with-parsed-tramp-file-name tramp-test-temporary-file-directory nil | 6220 | (with-parsed-tramp-file-name tramp-test-temporary-file-directory nil |
| 6159 | (skip-unless (tramp-get-remote-stat v))) | 6221 | (skip-unless (tramp-get-remote-stat v))) |
| 6160 | 6222 | ||
| @@ -6177,6 +6239,8 @@ Use the `perl' command." | |||
| 6177 | (skip-unless (not (tramp--test-windows-nt-and-pscp-psftp-p))) | 6239 | (skip-unless (not (tramp--test-windows-nt-and-pscp-psftp-p))) |
| 6178 | (skip-unless (not (tramp--test-ksh-p))) | 6240 | (skip-unless (not (tramp--test-ksh-p))) |
| 6179 | (skip-unless (not (tramp--test-crypt-p))) | 6241 | (skip-unless (not (tramp--test-crypt-p))) |
| 6242 | (skip-unless (or (tramp--test-emacs26-p) (not (tramp--test-rclone-p)))) | ||
| 6243 | ;; We cannot use `tramp-test-vec', because this fails during compilation. | ||
| 6180 | (with-parsed-tramp-file-name tramp-test-temporary-file-directory nil | 6244 | (with-parsed-tramp-file-name tramp-test-temporary-file-directory nil |
| 6181 | (skip-unless (tramp-get-remote-perl v))) | 6245 | (skip-unless (tramp-get-remote-perl v))) |
| 6182 | 6246 | ||
| @@ -6202,6 +6266,7 @@ Use the `ls' command." | |||
| 6202 | (skip-unless (not (tramp--test-windows-nt-and-pscp-psftp-p))) | 6266 | (skip-unless (not (tramp--test-windows-nt-and-pscp-psftp-p))) |
| 6203 | (skip-unless (not (tramp--test-ksh-p))) | 6267 | (skip-unless (not (tramp--test-ksh-p))) |
| 6204 | (skip-unless (not (tramp--test-crypt-p))) | 6268 | (skip-unless (not (tramp--test-crypt-p))) |
| 6269 | (skip-unless (or (tramp--test-emacs26-p) (not (tramp--test-rclone-p)))) | ||
| 6205 | 6270 | ||
| 6206 | (let ((tramp-connection-properties | 6271 | (let ((tramp-connection-properties |
| 6207 | (append | 6272 | (append |
| @@ -6490,7 +6555,7 @@ process sentinels. They shall not disturb each other." | |||
| 6490 | (message \"Tramp loaded: %%s\" (and (file-remote-p %S) t)))" | 6555 | (message \"Tramp loaded: %%s\" (and (file-remote-p %S) t)))" |
| 6491 | tramp-test-temporary-file-directory))) | 6556 | tramp-test-temporary-file-directory))) |
| 6492 | (should | 6557 | (should |
| 6493 | (string-match | 6558 | (string-match-p |
| 6494 | "Tramp loaded: t[\n\r]+" | 6559 | "Tramp loaded: t[\n\r]+" |
| 6495 | (shell-command-to-string | 6560 | (shell-command-to-string |
| 6496 | (format | 6561 | (format |
| @@ -6521,7 +6586,7 @@ process sentinels. They shall not disturb each other." | |||
| 6521 | ;; Tramp doesn't load when `tramp-mode' is nil. | 6586 | ;; Tramp doesn't load when `tramp-mode' is nil. |
| 6522 | (dolist (tm '(t nil)) | 6587 | (dolist (tm '(t nil)) |
| 6523 | (should | 6588 | (should |
| 6524 | (string-match | 6589 | (string-match-p |
| 6525 | (format | 6590 | (format |
| 6526 | "Tramp loaded: nil[\n\r]+Tramp loaded: nil[\n\r]+Tramp loaded: %s[\n\r]+" | 6591 | "Tramp loaded: nil[\n\r]+Tramp loaded: nil[\n\r]+Tramp loaded: %s[\n\r]+" |
| 6527 | tm) | 6592 | tm) |
| @@ -6547,7 +6612,7 @@ process sentinels. They shall not disturb each other." | |||
| 6547 | tramp-test-temporary-file-directory | 6612 | tramp-test-temporary-file-directory |
| 6548 | temporary-file-directory))) | 6613 | temporary-file-directory))) |
| 6549 | (should-not | 6614 | (should-not |
| 6550 | (string-match | 6615 | (string-match-p |
| 6551 | "Recursive load" | 6616 | "Recursive load" |
| 6552 | (shell-command-to-string | 6617 | (shell-command-to-string |
| 6553 | (format | 6618 | (format |
| @@ -6572,7 +6637,7 @@ process sentinels. They shall not disturb each other." | |||
| 6572 | (load-path (cons \"/foo:bar:\" load-path))) \ | 6637 | (load-path (cons \"/foo:bar:\" load-path))) \ |
| 6573 | (tramp-cleanup-all-connections))")) | 6638 | (tramp-cleanup-all-connections))")) |
| 6574 | (should | 6639 | (should |
| 6575 | (string-match | 6640 | (string-match-p |
| 6576 | (format | 6641 | (format |
| 6577 | "Loading %s" | 6642 | "Loading %s" |
| 6578 | (regexp-quote | 6643 | (regexp-quote |
| @@ -6619,11 +6684,11 @@ Since it unloads Tramp, it shall be the last test to run." | |||
| 6619 | (lambda (x) | 6684 | (lambda (x) |
| 6620 | (and (or (and (boundp x) (null (local-variable-if-set-p x))) | 6685 | (and (or (and (boundp x) (null (local-variable-if-set-p x))) |
| 6621 | (and (functionp x) (null (autoloadp (symbol-function x))))) | 6686 | (and (functionp x) (null (autoloadp (symbol-function x))))) |
| 6622 | (string-match "^tramp" (symbol-name x)) | 6687 | (string-match-p "^tramp" (symbol-name x)) |
| 6623 | ;; `tramp-completion-mode' is autoloaded in Emacs < 28.1. | 6688 | ;; `tramp-completion-mode' is autoloaded in Emacs < 28.1. |
| 6624 | (not (eq 'tramp-completion-mode x)) | 6689 | (not (eq 'tramp-completion-mode x)) |
| 6625 | (not (string-match "^tramp\\(-archive\\)?--?test" (symbol-name x))) | 6690 | (not (string-match-p "^tramp\\(-archive\\)?--?test" (symbol-name x))) |
| 6626 | (not (string-match "unload-hook$" (symbol-name x))) | 6691 | (not (string-match-p "unload-hook$" (symbol-name x))) |
| 6627 | (ert-fail (format "`%s' still bound" x))))) | 6692 | (ert-fail (format "`%s' still bound" x))))) |
| 6628 | ;; The defstruct `tramp-file-name' and all its internal functions | 6693 | ;; The defstruct `tramp-file-name' and all its internal functions |
| 6629 | ;; shall be purged. | 6694 | ;; shall be purged. |
| @@ -6631,15 +6696,15 @@ Since it unloads Tramp, it shall be the last test to run." | |||
| 6631 | (mapatoms | 6696 | (mapatoms |
| 6632 | (lambda (x) | 6697 | (lambda (x) |
| 6633 | (and (functionp x) | 6698 | (and (functionp x) |
| 6634 | (string-match "tramp-file-name" (symbol-name x)) | 6699 | (string-match-p "tramp-file-name" (symbol-name x)) |
| 6635 | (ert-fail (format "Structure function `%s' still exists" x))))) | 6700 | (ert-fail (format "Structure function `%s' still exists" x))))) |
| 6636 | ;; There shouldn't be left a hook function containing a Tramp | 6701 | ;; There shouldn't be left a hook function containing a Tramp |
| 6637 | ;; function. We do not regard the Tramp unload hooks. | 6702 | ;; function. We do not regard the Tramp unload hooks. |
| 6638 | (mapatoms | 6703 | (mapatoms |
| 6639 | (lambda (x) | 6704 | (lambda (x) |
| 6640 | (and (boundp x) | 6705 | (and (boundp x) |
| 6641 | (string-match "-\\(hook\\|function\\)s?$" (symbol-name x)) | 6706 | (string-match-p "-\\(hook\\|function\\)s?$" (symbol-name x)) |
| 6642 | (not (string-match "unload-hook$" (symbol-name x))) | 6707 | (not (string-match-p "unload-hook$" (symbol-name x))) |
| 6643 | (consp (symbol-value x)) | 6708 | (consp (symbol-value x)) |
| 6644 | (ignore-errors (all-completions "tramp" (symbol-value x))) | 6709 | (ignore-errors (all-completions "tramp" (symbol-value x))) |
| 6645 | (ert-fail (format "Hook `%s' still contains Tramp function" x)))))) | 6710 | (ert-fail (format "Hook `%s' still contains Tramp function" x)))))) |
diff --git a/test/lisp/progmodes/tcl-tests.el b/test/lisp/progmodes/tcl-tests.el index 8ff85470ece..cf1ed2896e4 100644 --- a/test/lisp/progmodes/tcl-tests.el +++ b/test/lisp/progmodes/tcl-tests.el | |||
| @@ -50,14 +50,14 @@ | |||
| 50 | (insert "proc notinthis {} {\n # nothing\n}\n\n") | 50 | (insert "proc notinthis {} {\n # nothing\n}\n\n") |
| 51 | (should-not (add-log-current-defun)))) | 51 | (should-not (add-log-current-defun)))) |
| 52 | 52 | ||
| 53 | (ert-deftest tcl-mode-function-name () | 53 | (ert-deftest tcl-mode-function-name-2 () |
| 54 | (with-temp-buffer | 54 | (with-temp-buffer |
| 55 | (tcl-mode) | 55 | (tcl-mode) |
| 56 | (insert "proc simple {} {\n # nothing\n}") | 56 | (insert "proc simple {} {\n # nothing\n}") |
| 57 | (backward-char 3) | 57 | (backward-char 3) |
| 58 | (should (equal "simple" (add-log-current-defun))))) | 58 | (should (equal "simple" (add-log-current-defun))))) |
| 59 | 59 | ||
| 60 | (ert-deftest tcl-mode-function-name () | 60 | (ert-deftest tcl-mode-function-name-3 () |
| 61 | (with-temp-buffer | 61 | (with-temp-buffer |
| 62 | (tcl-mode) | 62 | (tcl-mode) |
| 63 | (insert "proc inthis {} {\n # nothing\n") | 63 | (insert "proc inthis {} {\n # nothing\n") |
| @@ -72,6 +72,16 @@ | |||
| 72 | (indent-region (point-min) (point-max)) | 72 | (indent-region (point-min) (point-max)) |
| 73 | (should (equal (buffer-string) text))))) | 73 | (should (equal (buffer-string) text))))) |
| 74 | 74 | ||
| 75 | ;; From bug#44834 | ||
| 76 | (ert-deftest tcl-mode-namespace-indent-2 () | ||
| 77 | :expected-result :failed | ||
| 78 | (with-temp-buffer | ||
| 79 | (tcl-mode) | ||
| 80 | (let ((text "namespace eval Foo {\n proc foo {} {}\n\n proc bar {}{}}\n")) | ||
| 81 | (insert text) | ||
| 82 | (indent-region (point-min) (point-max)) | ||
| 83 | (should (equal (buffer-string) text))))) | ||
| 84 | |||
| 75 | (provide 'tcl-tests) | 85 | (provide 'tcl-tests) |
| 76 | 86 | ||
| 77 | ;;; tcl-tests.el ends here | 87 | ;;; tcl-tests.el ends here |
diff --git a/test/lisp/subr-tests.el b/test/lisp/subr-tests.el index 245a4a7c3af..843981fe8e8 100644 --- a/test/lisp/subr-tests.el +++ b/test/lisp/subr-tests.el | |||
| @@ -87,6 +87,17 @@ | |||
| 87 | ;; Returns the symbol. | 87 | ;; Returns the symbol. |
| 88 | (should (eq (define-prefix-command 'foo-bar) 'foo-bar))) | 88 | (should (eq (define-prefix-command 'foo-bar) 'foo-bar))) |
| 89 | 89 | ||
| 90 | (ert-deftest subr-test-local-key-binding () | ||
| 91 | (with-temp-buffer | ||
| 92 | (emacs-lisp-mode) | ||
| 93 | (should (keymapp (local-key-binding [menu-bar]))) | ||
| 94 | (should-not (local-key-binding [f12])))) | ||
| 95 | |||
| 96 | (ert-deftest subr-test-global-key-binding () | ||
| 97 | (should (eq (global-key-binding [f1]) 'help-command)) | ||
| 98 | (should (eq (global-key-binding "x") 'self-insert-command)) | ||
| 99 | (should-not (global-key-binding [f12]))) | ||
| 100 | |||
| 90 | 101 | ||
| 91 | ;;;; Mode hooks. | 102 | ;;;; Mode hooks. |
| 92 | 103 | ||
| @@ -433,6 +444,15 @@ See https://debbugs.gnu.org/cgi/bugreport.cgi?bug=19350." | |||
| 433 | (should (equal (flatten-tree '(1 ("foo" "bar") 2)) | 444 | (should (equal (flatten-tree '(1 ("foo" "bar") 2)) |
| 434 | '(1 "foo" "bar" 2)))) | 445 | '(1 "foo" "bar" 2)))) |
| 435 | 446 | ||
| 447 | (ert-deftest subr--tests-letrec () | ||
| 448 | ;; Test that simple cases of `letrec' get optimized back to `let*'. | ||
| 449 | (should (equal (macroexpand '(letrec ((subr-tests-var1 1) | ||
| 450 | (subr-tests-var2 subr-tests-var1)) | ||
| 451 | (+ subr-tests-var1 subr-tests-var2))) | ||
| 452 | '(let* ((subr-tests-var1 1) | ||
| 453 | (subr-tests-var2 subr-tests-var1)) | ||
| 454 | (+ subr-tests-var1 subr-tests-var2))))) | ||
| 455 | |||
| 436 | (defvar subr-tests--hook nil) | 456 | (defvar subr-tests--hook nil) |
| 437 | 457 | ||
| 438 | (ert-deftest subr-tests-add-hook-depth () | 458 | (ert-deftest subr-tests-add-hook-depth () |
diff --git a/test/lisp/textmodes/fill-tests.el b/test/lisp/textmodes/fill-tests.el index f2c63a93d3e..21efe620999 100644 --- a/test/lisp/textmodes/fill-tests.el +++ b/test/lisp/textmodes/fill-tests.el | |||
| @@ -44,6 +44,37 @@ | |||
| 44 | (fill-paragraph) | 44 | (fill-paragraph) |
| 45 | (should (string= (buffer-string) "Abc\nd efg\n(h ijk).")))) | 45 | (should (string= (buffer-string) "Abc\nd efg\n(h ijk).")))) |
| 46 | 46 | ||
| 47 | (ert-deftest fill-test-unbreakable-paragraph () | ||
| 48 | (with-temp-buffer | ||
| 49 | (let ((string "aaa = baaaaaaaaaaaaaaaaaaaaaaaaaaaa\n")) | ||
| 50 | (insert string) | ||
| 51 | (goto-char (point-min)) | ||
| 52 | (search-forward "b") | ||
| 53 | (let* ((pos (point)) | ||
| 54 | (beg (line-beginning-position)) | ||
| 55 | (end (line-end-position)) | ||
| 56 | (fill-prefix (make-string (- pos beg) ?\s)) | ||
| 57 | ;; `fill-column' is too small to accomodate the current line | ||
| 58 | (fill-column (- end beg 10))) | ||
| 59 | (fill-region-as-paragraph beg end nil nil pos)) | ||
| 60 | (should (equal (buffer-string) string))))) | ||
| 61 | |||
| 62 | (ert-deftest fill-test-breakable-paragraph () | ||
| 63 | (with-temp-buffer | ||
| 64 | (let ((string "aaa = baaaaaaaa aaaaaaaaaa aaaaaaaaaa\n")) | ||
| 65 | (insert string) | ||
| 66 | (goto-char (point-min)) | ||
| 67 | (search-forward "b") | ||
| 68 | (let* ((pos (point)) | ||
| 69 | (beg (line-beginning-position)) | ||
| 70 | (end (line-end-position)) | ||
| 71 | (fill-prefix (make-string (- pos beg) ?\s)) | ||
| 72 | ;; `fill-column' is too small to accomodate the current line | ||
| 73 | (fill-column (- end beg 10))) | ||
| 74 | (fill-region-as-paragraph beg end nil nil pos)) | ||
| 75 | (should (equal | ||
| 76 | (buffer-string) | ||
| 77 | "aaa = baaaaaaaa aaaaaaaaaa\n aaaaaaaaaa\n"))))) | ||
| 47 | 78 | ||
| 48 | (provide 'fill-tests) | 79 | (provide 'fill-tests) |
| 49 | 80 | ||
diff --git a/test/src/decompress-tests.el b/test/src/decompress-tests.el index 67a7fefb05e..520445cca5a 100644 --- a/test/src/decompress-tests.el +++ b/test/src/decompress-tests.el | |||
| @@ -29,16 +29,16 @@ | |||
| 29 | 29 | ||
| 30 | (ert-deftest zlib--decompress () | 30 | (ert-deftest zlib--decompress () |
| 31 | "Test decompressing a gzipped file." | 31 | "Test decompressing a gzipped file." |
| 32 | (when (and (fboundp 'zlib-available-p) | 32 | (skip-unless (and (fboundp 'zlib-available-p) |
| 33 | (zlib-available-p)) | 33 | (zlib-available-p))) |
| 34 | (should (string= | 34 | (should (string= |
| 35 | (with-temp-buffer | 35 | (with-temp-buffer |
| 36 | (set-buffer-multibyte nil) | 36 | (set-buffer-multibyte nil) |
| 37 | (insert-file-contents-literally | 37 | (insert-file-contents-literally |
| 38 | (expand-file-name "foo.gz" zlib-tests-data-directory)) | 38 | (expand-file-name "foo.gz" zlib-tests-data-directory)) |
| 39 | (zlib-decompress-region (point-min) (point-max)) | 39 | (zlib-decompress-region (point-min) (point-max)) |
| 40 | (buffer-string)) | 40 | (buffer-string)) |
| 41 | "foo\n")))) | 41 | "foo\n"))) |
| 42 | 42 | ||
| 43 | (provide 'decompress-tests) | 43 | (provide 'decompress-tests) |
| 44 | 44 | ||
diff --git a/test/src/fns-tests.el b/test/src/fns-tests.el index a9daf878b81..e0aed2a71b6 100644 --- a/test/src/fns-tests.el +++ b/test/src/fns-tests.el | |||
| @@ -1040,3 +1040,61 @@ | |||
| 1040 | (let ((list (list 1))) | 1040 | (let ((list (list 1))) |
| 1041 | (setcdr list list) | 1041 | (setcdr list list) |
| 1042 | (length< list #x1fffe)))) | 1042 | (length< list #x1fffe)))) |
| 1043 | |||
| 1044 | (defun approx-equal (list1 list2) | ||
| 1045 | (and (equal (length list1) (length list2)) | ||
| 1046 | (cl-loop for v1 in list1 | ||
| 1047 | for v2 in list2 | ||
| 1048 | when (not (or (= v1 v2) | ||
| 1049 | (< (abs (- v1 v2)) 0.1))) | ||
| 1050 | return nil | ||
| 1051 | finally return t))) | ||
| 1052 | |||
| 1053 | (ert-deftest test-buffer-line-stats-nogap () | ||
| 1054 | (with-temp-buffer | ||
| 1055 | (insert "") | ||
| 1056 | (should (approx-equal (buffer-line-statistics) '(0 0 0)))) | ||
| 1057 | (with-temp-buffer | ||
| 1058 | (insert "123\n") | ||
| 1059 | (should (approx-equal (buffer-line-statistics) '(1 3 3)))) | ||
| 1060 | (with-temp-buffer | ||
| 1061 | (insert "123\n12345\n123\n") | ||
| 1062 | (should (approx-equal (buffer-line-statistics) '(3 5 3.66)))) | ||
| 1063 | (with-temp-buffer | ||
| 1064 | (insert "123\n12345\n123") | ||
| 1065 | (should (approx-equal (buffer-line-statistics) '(3 5 3.66)))) | ||
| 1066 | (with-temp-buffer | ||
| 1067 | (insert "123\n12345") | ||
| 1068 | (should (approx-equal (buffer-line-statistics) '(2 5 4)))) | ||
| 1069 | |||
| 1070 | (with-temp-buffer | ||
| 1071 | (insert "123\n12é45\n123\n") | ||
| 1072 | (should (approx-equal (buffer-line-statistics) '(3 6 4)))) | ||
| 1073 | |||
| 1074 | (with-temp-buffer | ||
| 1075 | (insert "\n\n\n") | ||
| 1076 | (should (approx-equal (buffer-line-statistics) '(3 0 0))))) | ||
| 1077 | |||
| 1078 | (ert-deftest test-buffer-line-stats-gap () | ||
| 1079 | (with-temp-buffer | ||
| 1080 | (dotimes (_ 1000) | ||
| 1081 | (insert "12345678901234567890123456789012345678901234567890\n")) | ||
| 1082 | (goto-char (point-min)) | ||
| 1083 | ;; This should make a gap appear. | ||
| 1084 | (insert "123\n") | ||
| 1085 | (delete-region (point-min) (point)) | ||
| 1086 | (should (approx-equal (buffer-line-statistics) '(1000 50 50.0)))) | ||
| 1087 | (with-temp-buffer | ||
| 1088 | (dotimes (_ 1000) | ||
| 1089 | (insert "12345678901234567890123456789012345678901234567890\n")) | ||
| 1090 | (goto-char (point-min)) | ||
| 1091 | (insert "123\n") | ||
| 1092 | (should (approx-equal (buffer-line-statistics) '(1001 50 49.9)))) | ||
| 1093 | (with-temp-buffer | ||
| 1094 | (dotimes (_ 1000) | ||
| 1095 | (insert "12345678901234567890123456789012345678901234567890\n")) | ||
| 1096 | (goto-char (point-min)) | ||
| 1097 | (insert "123\n") | ||
| 1098 | (goto-char (point-max)) | ||
| 1099 | (insert "fóo") | ||
| 1100 | (should (approx-equal (buffer-line-statistics) '(1002 50 49.9))))) | ||
diff --git a/test/src/lread-tests.el b/test/src/lread-tests.el index edf88214f97..f2a60bcf327 100644 --- a/test/src/lread-tests.el +++ b/test/src/lread-tests.el | |||
| @@ -190,4 +190,10 @@ literals (Bug#20852)." | |||
| 190 | (ert-deftest lread-circular-hash () | 190 | (ert-deftest lread-circular-hash () |
| 191 | (should-error (read "#s(hash-table data #0=(#0# . #0#))"))) | 191 | (should-error (read "#s(hash-table data #0=(#0# . #0#))"))) |
| 192 | 192 | ||
| 193 | (ert-deftest test-inhibit-interaction () | ||
| 194 | (let ((inhibit-interaction t)) | ||
| 195 | (should-error (read-char "foo: ")) | ||
| 196 | (should-error (read-event "foo: ")) | ||
| 197 | (should-error (read-char-exclusive "foo: ")))) | ||
| 198 | |||
| 193 | ;;; lread-tests.el ends here | 199 | ;;; lread-tests.el ends here |
diff --git a/test/src/minibuf-tests.el b/test/src/minibuf-tests.el index b9cd255462d..28119fc999e 100644 --- a/test/src/minibuf-tests.el +++ b/test/src/minibuf-tests.el | |||
| @@ -410,5 +410,20 @@ | |||
| 410 | (should (equal (try-completion "baz" '("bAz" "baz")) | 410 | (should (equal (try-completion "baz" '("bAz" "baz")) |
| 411 | (try-completion "baz" '("baz" "bAz")))))) | 411 | (try-completion "baz" '("baz" "bAz")))))) |
| 412 | 412 | ||
| 413 | (ert-deftest test-inhibit-interaction () | ||
| 414 | (let ((inhibit-interaction t)) | ||
| 415 | (should-error (read-from-minibuffer "foo: ")) | ||
| 416 | |||
| 417 | (should-error (y-or-n-p "foo: ")) | ||
| 418 | (should-error (yes-or-no-p "foo: ")) | ||
| 419 | (should-error (read-blanks-no-input "foo: ")) | ||
| 420 | |||
| 421 | ;; See that we get the expected error. | ||
| 422 | (should (eq (condition-case nil | ||
| 423 | (read-from-minibuffer "foo: ") | ||
| 424 | (inhibited-interaction 'inhibit) | ||
| 425 | (error nil)) | ||
| 426 | 'inhibit)))) | ||
| 427 | |||
| 413 | 428 | ||
| 414 | ;;; minibuf-tests.el ends here | 429 | ;;; minibuf-tests.el ends here |
diff --git a/test/src/process-tests.el b/test/src/process-tests.el index ca98f54bdb1..57097cfa052 100644 --- a/test/src/process-tests.el +++ b/test/src/process-tests.el | |||
| @@ -28,6 +28,7 @@ | |||
| 28 | (require 'puny) | 28 | (require 'puny) |
| 29 | (require 'rx) | 29 | (require 'rx) |
| 30 | (require 'subr-x) | 30 | (require 'subr-x) |
| 31 | (require 'dns) | ||
| 31 | 32 | ||
| 32 | ;; Timeout in seconds; the test fails if the timeout is reached. | 33 | ;; Timeout in seconds; the test fails if the timeout is reached. |
| 33 | (defvar process-test-sentinel-wait-timeout 2.0) | 34 | (defvar process-test-sentinel-wait-timeout 2.0) |
| @@ -350,14 +351,23 @@ See Bug#30460." | |||
| 350 | ;; All the following tests require working DNS, which appears not to | 351 | ;; All the following tests require working DNS, which appears not to |
| 351 | ;; be the case for hydra.nixos.org, so disable them there for now. | 352 | ;; be the case for hydra.nixos.org, so disable them there for now. |
| 352 | 353 | ||
| 354 | ;; This will need updating when IANA assign more IPv6 global ranges. | ||
| 355 | (defun ipv6-is-available () | ||
| 356 | (and (featurep 'make-network-process '(:family ipv6)) | ||
| 357 | (cl-rassoc-if | ||
| 358 | (lambda (elt) | ||
| 359 | (and (eq 9 (length elt)) | ||
| 360 | (= (logand (aref elt 0) #xe000) #x2000))) | ||
| 361 | (network-interface-list)))) | ||
| 362 | |||
| 353 | (ert-deftest lookup-family-specification () | 363 | (ert-deftest lookup-family-specification () |
| 354 | "`network-lookup-address-info' should only accept valid family symbols." | 364 | "`network-lookup-address-info' should only accept valid family symbols." |
| 355 | (skip-unless (not (getenv "EMACS_HYDRA_CI"))) | 365 | (skip-unless (not (getenv "EMACS_HYDRA_CI"))) |
| 356 | (with-timeout (60 (ert-fail "Test timed out")) | 366 | (with-timeout (60 (ert-fail "Test timed out")) |
| 357 | (should-error (network-lookup-address-info "google.com" 'both)) | 367 | (should-error (network-lookup-address-info "localhost" 'both)) |
| 358 | (should (network-lookup-address-info "google.com" 'ipv4)) | 368 | (should (network-lookup-address-info "localhost" 'ipv4)) |
| 359 | (when (featurep 'make-network-process '(:family ipv6)) | 369 | (when (ipv6-is-available) |
| 360 | (should (network-lookup-address-info "google.com" 'ipv6))))) | 370 | (should (network-lookup-address-info "localhost" 'ipv6))))) |
| 361 | 371 | ||
| 362 | (ert-deftest lookup-unicode-domains () | 372 | (ert-deftest lookup-unicode-domains () |
| 363 | "Unicode domains should fail." | 373 | "Unicode domains should fail." |
| @@ -380,7 +390,8 @@ See Bug#30460." | |||
| 380 | (addresses-v4 (network-lookup-address-info "google.com" 'ipv4))) | 390 | (addresses-v4 (network-lookup-address-info "google.com" 'ipv4))) |
| 381 | (should addresses-both) | 391 | (should addresses-both) |
| 382 | (should addresses-v4)) | 392 | (should addresses-v4)) |
| 383 | (when (featurep 'make-network-process '(:family ipv6)) | 393 | (when (and (ipv6-is-available) |
| 394 | (dns-query "google.com" 'AAAA)) | ||
| 384 | (should (network-lookup-address-info "google.com" 'ipv6))))) | 395 | (should (network-lookup-address-info "google.com" 'ipv6))))) |
| 385 | 396 | ||
| 386 | (ert-deftest non-existent-lookup-failure () | 397 | (ert-deftest non-existent-lookup-failure () |
| @@ -565,6 +576,11 @@ FD_SETSIZE file descriptors (Bug#24325)." | |||
| 565 | (should (memq (process-status process) '(run exit))) | 576 | (should (memq (process-status process) '(run exit))) |
| 566 | (when (process-live-p process) | 577 | (when (process-live-p process) |
| 567 | (process-send-eof process)) | 578 | (process-send-eof process)) |
| 579 | ;; FIXME: This `sleep-for' shouldn't be needed. It | ||
| 580 | ;; indicates a bug in Emacs; perhaps SIGCHLD is | ||
| 581 | ;; received in parallel with `accept-process-output', | ||
| 582 | ;; causing the latter to hang. | ||
| 583 | (sleep-for 0.1) | ||
| 568 | (while (accept-process-output process)) | 584 | (while (accept-process-output process)) |
| 569 | (should (eq (process-status process) 'exit)) | 585 | (should (eq (process-status process) 'exit)) |
| 570 | ;; If there's an error between fork and exec, Emacs | 586 | ;; If there's an error between fork and exec, Emacs |
diff --git a/test/src/xdisp-tests.el b/test/src/xdisp-tests.el index d13ce77a997..ec96d777ffb 100644 --- a/test/src/xdisp-tests.el +++ b/test/src/xdisp-tests.el | |||
| @@ -72,4 +72,34 @@ | |||
| 72 | (should (equal (nth 0 posns) (nth 1 posns))) | 72 | (should (equal (nth 0 posns) (nth 1 posns))) |
| 73 | (should (equal (nth 1 posns) (nth 2 posns))))) | 73 | (should (equal (nth 1 posns) (nth 2 posns))))) |
| 74 | 74 | ||
| 75 | (ert-deftest xdisp-tests--window-text-pixel-size () ;; bug#45748 | ||
| 76 | (with-temp-buffer | ||
| 77 | (insert "xxx") | ||
| 78 | (let* ((window | ||
| 79 | (display-buffer (current-buffer) '(display-buffer-in-child-frame . nil))) | ||
| 80 | (char-width (frame-char-width)) | ||
| 81 | (size (window-text-pixel-size nil t t))) | ||
| 82 | (delete-frame (window-frame window)) | ||
| 83 | (should (equal (/ (car size) char-width) 3))))) | ||
| 84 | |||
| 85 | (ert-deftest xdisp-tests--window-text-pixel-size-leading-space () ;; bug#45748 | ||
| 86 | (with-temp-buffer | ||
| 87 | (insert " xx") | ||
| 88 | (let* ((window | ||
| 89 | (display-buffer (current-buffer) '(display-buffer-in-child-frame . nil))) | ||
| 90 | (char-width (frame-char-width)) | ||
| 91 | (size (window-text-pixel-size nil t t))) | ||
| 92 | (delete-frame (window-frame window)) | ||
| 93 | (should (equal (/ (car size) char-width) 3))))) | ||
| 94 | |||
| 95 | (ert-deftest xdisp-tests--window-text-pixel-size-trailing-space () ;; bug#45748 | ||
| 96 | (with-temp-buffer | ||
| 97 | (insert "xx ") | ||
| 98 | (let* ((window | ||
| 99 | (display-buffer (current-buffer) '(display-buffer-in-child-frame . nil))) | ||
| 100 | (char-width (frame-char-width)) | ||
| 101 | (size (window-text-pixel-size nil t t))) | ||
| 102 | (delete-frame (window-frame window)) | ||
| 103 | (should (equal (/ (car size) char-width) 3))))) | ||
| 104 | |||
| 75 | ;;; xdisp-tests.el ends here | 105 | ;;; xdisp-tests.el ends here |
diff --git a/test/src/xml-tests.el b/test/src/xml-tests.el index 632cf965fa2..a35b4d2ccc8 100644 --- a/test/src/xml-tests.el +++ b/test/src/xml-tests.el | |||
| @@ -44,12 +44,12 @@ | |||
| 44 | 44 | ||
| 45 | (ert-deftest libxml-tests () | 45 | (ert-deftest libxml-tests () |
| 46 | "Test libxml." | 46 | "Test libxml." |
| 47 | (when (fboundp 'libxml-parse-xml-region) | 47 | (skip-unless (fboundp 'libxml-parse-xml-region)) |
| 48 | (with-temp-buffer | 48 | (with-temp-buffer |
| 49 | (dolist (test libxml-tests--data-comments-preserved) | 49 | (dolist (test libxml-tests--data-comments-preserved) |
| 50 | (erase-buffer) | 50 | (erase-buffer) |
| 51 | (insert (car test)) | 51 | (insert (car test)) |
| 52 | (should (equal (cdr test) | 52 | (should (equal (cdr test) |
| 53 | (libxml-parse-xml-region (point-min) (point-max)))))))) | 53 | (libxml-parse-xml-region (point-min) (point-max))))))) |
| 54 | 54 | ||
| 55 | ;;; libxml-tests.el ends here | 55 | ;;; libxml-tests.el ends here |