diff options
author | Yuuki Harano <masm+github@masm11.me> | 2021-01-30 23:37:19 +0900 |
---|---|---|
committer | Yuuki Harano <masm+github@masm11.me> | 2021-01-30 23:37:19 +0900 |
commit | 50c76b844bc79309b4f5d9e28a2386b9a6f735b7 (patch) | |
tree | 29f8273d8afccae1f16b723c36548cee150cb0bc /test | |
parent | 563a0d94c379292bd88e83f18560ed21c497cea9 (diff) | |
parent | 96f20120c97a0a329fff81a0cc3747082a8a2c55 (diff) | |
download | emacs-50c76b844bc79309b4f5d9e28a2386b9a6f735b7.tar.gz emacs-50c76b844bc79309b4f5d9e28a2386b9a6f735b7.tar.bz2 emacs-50c76b844bc79309b4f5d9e28a2386b9a6f735b7.zip |
Merge branch 'master' of git.sv.gnu.org:/srv/git/emacs into feature/pgtk
Diffstat (limited to 'test')
-rw-r--r-- | test/Makefile.in | 5 | ||||
-rw-r--r-- | test/infra/gitlab-ci.yml | 4 | ||||
-rw-r--r-- | test/lisp/autorevert-tests.el | 25 | ||||
-rw-r--r-- | test/lisp/electric-tests.el | 15 | ||||
-rw-r--r-- | test/lisp/emacs-lisp/bytecomp-resources/foo-inlinable.el | 6 | ||||
-rw-r--r-- | test/lisp/emacs-lisp/bytecomp-resources/nowarn-inline-after-defvar.el | 17 | ||||
-rw-r--r-- | test/lisp/emacs-lisp/bytecomp-tests.el | 4 | ||||
-rw-r--r-- | test/lisp/emacs-lisp/cl-lib-tests.el | 9 | ||||
-rw-r--r-- | test/lisp/emacs-lisp/seq-tests.el | 23 | ||||
-rw-r--r-- | test/lisp/faces-tests.el | 8 | ||||
-rw-r--r-- | test/lisp/find-cmd-tests.el | 45 | ||||
-rw-r--r-- | test/lisp/net/sasl-cram-tests.el | 46 | ||||
-rw-r--r-- | test/lisp/net/sasl-tests.el | 59 | ||||
-rw-r--r-- | test/lisp/net/tramp-tests.el | 52 | ||||
-rw-r--r-- | test/lisp/progmodes/asm-mode-tests.el | 10 | ||||
-rw-r--r-- | test/lisp/progmodes/elisp-mode-tests.el | 56 | ||||
-rw-r--r-- | test/lisp/thingatpt-tests.el | 44 | ||||
-rwxr-xr-x | test/manual/indent/shell.sh | 7 | ||||
-rw-r--r-- | test/src/process-tests.el | 30 |
19 files changed, 407 insertions, 58 deletions
diff --git a/test/Makefile.in b/test/Makefile.in index c5e86df3761..f907602a622 100644 --- a/test/Makefile.in +++ b/test/Makefile.in @@ -122,8 +122,9 @@ MODULES_EMACSOPT := endif # The actual Emacs command run in the targets below. -# Prevent any setting of EMACSLOADPATH in user environment causing problems. -emacs = EMACSLOADPATH= \ +# Prevent any setting of EMACSLOADPATH in user environment causing problems, +# and prevent locals to influence the text of the errors we expect to receive. +emacs = LANG=C EMACSLOADPATH= \ EMACS_TEST_DIRECTORY=$(abspath $(srcdir)) \ $(GDB) "$(EMACS)" $(MODULES_EMACSOPT) $(EMACSOPT) diff --git a/test/infra/gitlab-ci.yml b/test/infra/gitlab-ci.yml index ddabacfe010..5a0ab54e4b9 100644 --- a/test/infra/gitlab-ci.yml +++ b/test/infra/gitlab-ci.yml @@ -72,6 +72,7 @@ default: - lisp/**/*.el - src/*.{h,c} - test/infra/* + - test/lib-src/*.el - test/lisp/**/*.el - test/src/*.el - changes: @@ -100,7 +101,8 @@ default: script: - docker pull ${CI_REGISTRY_IMAGE}:${target}-${BUILD_TAG} # TODO: with make -j4 several of the tests were failing, for example shadowfile-tests, but passed without it - - docker run -i --rm -e EMACS_EMBA_CI=${EMACS_EMBA_CI} ${CI_REGISTRY_IMAGE}:${target}-${BUILD_TAG} make ${make_params} + - 'export PWD=$(pwd)' + - 'docker run -i --rm -e EMACS_EMBA_CI=${EMACS_EMBA_CI} --volumes-from $(docker ps -q -f "label=com.gitlab.gitlab-runner.job.id=${CI_JOB_ID}"):ro ${CI_REGISTRY_IMAGE}:${target}-${BUILD_TAG} /bin/bash -c "git fetch ${PWD} HEAD && echo checking out these updated files && git diff --name-only FETCH_HEAD && ( git diff --name-only FETCH_HEAD | xargs git checkout -f FETCH_HEAD ) && make -j4 && make ${make_params}"' .build-template: rules: diff --git a/test/lisp/autorevert-tests.el b/test/lisp/autorevert-tests.el index 6da515bb2c8..45cf6353960 100644 --- a/test/lisp/autorevert-tests.el +++ b/test/lisp/autorevert-tests.el @@ -524,8 +524,10 @@ This expects `auto-revert--messages' to be bound by (auto-revert-test--write-file "1-b" file-1) (auto-revert-test--wait-for-buffer-text buf-1 "1-b" (auto-revert--timeout)) - (should (buffer-local-value - 'auto-revert-notify-watch-descriptor buf-1)) + ;; On emba, `buf-1' is a killed buffer. + (when (buffer-live-p buf-1) + (should (buffer-local-value + 'auto-revert-notify-watch-descriptor buf-1))) ;; Write a buffer to a new file, then modify the new file on disk. (with-current-buffer buf-2 @@ -607,11 +609,12 @@ This expects `auto-revert--messages' to be bound by (should auto-revert-mode)) (dotimes (i num-buffers) - (add-to-list - 'buffers - (make-indirect-buffer - (car buffers) (format "%s-%d" (buffer-file-name (car buffers)) i) 'clone) - 'append)) + (push (make-indirect-buffer + (car buffers) + (format "%s-%d" (buffer-file-name (car buffers)) i) + 'clone) + buffers)) + (setq buffers (nreverse buffers)) (dolist (buf buffers) (with-current-buffer buf (should (string-equal (buffer-string) "any text")) @@ -638,10 +641,10 @@ This expects `auto-revert--messages' to be bound by (auto-revert-tests--write-file "any text" tmpfile (pop times)) (dotimes (i num-buffers) - (add-to-list - 'buffers - (generate-new-buffer (format "%s-%d" (file-name-nondirectory tmpfile) i)) - 'append)) + (push (generate-new-buffer + (format "%s-%d" (file-name-nondirectory tmpfile) i)) + buffers)) + (setq buffers (nreverse buffers)) (dolist (buf buffers) (with-current-buffer buf (insert-file-contents tmpfile 'visit) diff --git a/test/lisp/electric-tests.el b/test/lisp/electric-tests.el index 1b7beeaa366..62a42b7fe44 100644 --- a/test/lisp/electric-tests.el +++ b/test/lisp/electric-tests.el @@ -1,4 +1,4 @@ -;;; electric-tests.el --- tests for electric.el +;;; electric-tests.el --- tests for electric.el -*- lexical-binding: t; -*- ;; Copyright (C) 2013-2021 Free Software Foundation, Inc. @@ -135,9 +135,11 @@ The buffer's contents should %s: (length fixture) fixture (if fixture-fn (format "\nNow call this:\n\n%s" - (pp-to-string fixture-fn)) "") + (pp-to-string fixture-fn)) + "") (if bindings (format "\nEnsure the following bindings:\n\n%s" - (pp-to-string bindings)) "") + (pp-to-string bindings)) + "") char (if (string= fixture expected-string) "stay" "become") (replace-regexp-in-string "\n" "\\\\n" expected-string) @@ -163,8 +165,11 @@ The buffer's contents should %s: (test-in-comments t) (test-in-strings t) (test-in-code t) - (fixture-fn #'(lambda () - (electric-pair-mode 1)))) + ;; The semantics of CL's defmacro "default values" is subtle: + ;; contrary to the actual arguments, these are evaluated (and + ;; are expected to return the "default form"). + ;; `fixture-fn' contains a form whose evaluation returns a function. + (fixture-fn '#'electric-pair-mode)) `(progn ,@(cl-loop for mode in (eval modes) ;FIXME: avoid `eval' diff --git a/test/lisp/emacs-lisp/bytecomp-resources/foo-inlinable.el b/test/lisp/emacs-lisp/bytecomp-resources/foo-inlinable.el new file mode 100644 index 00000000000..47481574ea8 --- /dev/null +++ b/test/lisp/emacs-lisp/bytecomp-resources/foo-inlinable.el @@ -0,0 +1,6 @@ +;; -*- lexical-binding: t; -*- + +(defsubst foo-inlineable (foo-var) + (+ foo-var 2)) + +(provide 'foo-inlinable) diff --git a/test/lisp/emacs-lisp/bytecomp-resources/nowarn-inline-after-defvar.el b/test/lisp/emacs-lisp/bytecomp-resources/nowarn-inline-after-defvar.el new file mode 100644 index 00000000000..5582b2ab0ea --- /dev/null +++ b/test/lisp/emacs-lisp/bytecomp-resources/nowarn-inline-after-defvar.el @@ -0,0 +1,17 @@ +;; -*- lexical-binding: t; -*- + +;; In this test, we try and make sure that inlined functions's code isn't +;; mistakenly re-interpreted in the caller's context: we import an +;; inlinable function from another file where `foo-var' is a normal +;; lexical variable, and then call(inline) it in a function where +;; `foo-var' is a dynamically-scoped variable. + +(require 'foo-inlinable + (expand-file-name "foo-inlinable.el" + (file-name-directory + (or byte-compile-current-file load-file-name)))) + +(defvar foo-var) + +(defun foo-fun () + (+ (foo-inlineable 5) 1)) diff --git a/test/lisp/emacs-lisp/bytecomp-tests.el b/test/lisp/emacs-lisp/bytecomp-tests.el index 263736af4ed..980b402ca2d 100644 --- a/test/lisp/emacs-lisp/bytecomp-tests.el +++ b/test/lisp/emacs-lisp/bytecomp-tests.el @@ -713,6 +713,10 @@ Subtests signal errors if something goes wrong." "warn-wide-docstring-multiline.el" "defvar.*foo.*wider than.*characters") +(bytecomp--define-warning-file-test + "nowarn-inline-after-defvar.el" + "Lexical argument shadows" 'reverse) + ;;;; Macro expansion. diff --git a/test/lisp/emacs-lisp/cl-lib-tests.el b/test/lisp/emacs-lisp/cl-lib-tests.el index 97a44c43ef7..065ca4fa651 100644 --- a/test/lisp/emacs-lisp/cl-lib-tests.el +++ b/test/lisp/emacs-lisp/cl-lib-tests.el @@ -543,15 +543,7 @@ (apply (lambda (x) (+ x 1)) (list 8))))) '(5 (6 5) (6 6) 9)))) -(defun cl-lib-tests--dummy-function () - ;; Dummy function to see if the file is compiled. - t) - (ert-deftest cl-lib-defstruct-record () - ;; This test fails when compiled, see Bug#24402/27718. - :expected-result (if (byte-code-function-p - (symbol-function 'cl-lib-tests--dummy-function)) - :failed :passed) (cl-defstruct foo x) (let ((x (make-foo :x 42))) (should (recordp x)) @@ -566,6 +558,7 @@ (should (eq (type-of x) 'vector)) (cl-old-struct-compat-mode 1) + (defvar cl-struct-foo) (let ((cl-struct-foo (cl--struct-get-class 'foo))) (setf (symbol-function 'cl-struct-foo) :quick-object-witness-check) (should (eq (type-of x) 'foo)) diff --git a/test/lisp/emacs-lisp/seq-tests.el b/test/lisp/emacs-lisp/seq-tests.el index 670398354a6..05c7fbe781e 100644 --- a/test/lisp/emacs-lisp/seq-tests.el +++ b/test/lisp/emacs-lisp/seq-tests.el @@ -29,6 +29,9 @@ (require 'ert) (require 'seq) +(eval-when-compile + (require 'cl-lib)) + (defmacro with-test-sequences (spec &rest body) "Successively bind VAR to a list, vector, and string built from SEQ. Evaluate BODY for each created sequence. @@ -108,16 +111,12 @@ Evaluate BODY for each created sequence. '((a 0) (b 1) (c 2) (d 3))))) (ert-deftest test-seq-do-indexed () - (let ((result nil)) - (seq-do-indexed (lambda (elt i) - (add-to-list 'result (list elt i))) - nil) - (should (equal result nil))) + (let (result) + (seq-do-indexed (lambda (elt i) (push (list elt i) result)) ()) + (should-not result)) (with-test-sequences (seq '(4 5 6)) - (let ((result nil)) - (seq-do-indexed (lambda (elt i) - (add-to-list 'result (list elt i))) - seq) + (let (result) + (seq-do-indexed (lambda (elt i) (push (list elt i) result)) seq) (should (equal (seq-elt result 0) '(6 2))) (should (equal (seq-elt result 1) '(5 1))) (should (equal (seq-elt result 2) '(4 0)))))) @@ -410,12 +409,10 @@ Evaluate BODY for each created sequence. (ert-deftest test-seq-random-elt-take-all () (let ((seq '(a b c d e)) - (elts '())) - (should (= 0 (length elts))) + elts) (dotimes (_ 1000) (let ((random-elt (seq-random-elt seq))) - (add-to-list 'elts - random-elt))) + (cl-pushnew random-elt elts))) (should (= 5 (length elts))))) (ert-deftest test-seq-random-elt-signal-on-empty () diff --git a/test/lisp/faces-tests.el b/test/lisp/faces-tests.el index 6e77259fe1b..c0db9c9de17 100644 --- a/test/lisp/faces-tests.el +++ b/test/lisp/faces-tests.el @@ -217,5 +217,13 @@ )) ) +(ert-deftest test-tty-find-type () + (let ((pred (lambda (string) + (locate-library (concat "term/" string ".el"))))) + (should (tty-find-type pred "cygwin")) + (should (tty-find-type pred "cygwin-foo")) + (should (equal (tty-find-type pred "xterm") "xterm")) + (should (equal (tty-find-type pred "screen.xterm") "screen")))) + (provide 'faces-tests) ;;; faces-tests.el ends here diff --git a/test/lisp/find-cmd-tests.el b/test/lisp/find-cmd-tests.el new file mode 100644 index 00000000000..b8e0f273988 --- /dev/null +++ b/test/lisp/find-cmd-tests.el @@ -0,0 +1,45 @@ +;;; find-cmd-tests.el --- tests for find-cmd.el. -*- lexical-binding: t -*- + +;; Copyright (C) 2021 Free Software Foundation, Inc. + +;; This file is part of GNU Emacs. + +;; GNU Emacs is free software: you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. + +;; GNU Emacs is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. + +;;; Code: + +(require 'ert) +(require 'find-cmd) + +(ert-deftest find-cmd-test-find-cmd () + (should + (string-match + (rx "find " (+ any) + " \\( \\( -name .svn -or -name .git -or -name .CVS \\)" + " -prune -or -true \\)" + " \\( \\( \\(" " -name \\*.pl -or -name \\*.pm -or -name \\*.t \\)" + " -or -mtime \\+1 \\) -and \\( -fstype nfs -or -fstype ufs \\) \\) ") + (find-cmd '(prune (name ".svn" ".git" ".CVS")) + '(and (or (name "*.pl" "*.pm" "*.t") + (mtime "+1")) + (fstype "nfs" "ufs")))))) + +(ert-deftest find-cmd-test-find-cmd/error-unknown-atom () + (should-error (find-cmd '(unknown 123)))) + +(ert-deftest find-cmd-test-find-cmd/error-wrong-argnum () + (should-error (find-cmd '(name)))) + +(provide 'find-cmd-tests) +;;; find-cmd-tests.el ends here diff --git a/test/lisp/net/sasl-cram-tests.el b/test/lisp/net/sasl-cram-tests.el new file mode 100644 index 00000000000..e0230ddee60 --- /dev/null +++ b/test/lisp/net/sasl-cram-tests.el @@ -0,0 +1,46 @@ +;;; sasl-cram-tests.el --- tests for sasl-cram.el -*- lexical-binding: t; -*- + +;; Copyright (C) 2021 Free Software Foundation, Inc. + +;; Author: Stefan Kangas <stefankangas@gmail.com> + +;; This file is part of GNU Emacs. + +;; GNU Emacs is free software: you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. + +;; GNU Emacs is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. + +;;; Commentary: + +;; Test case from RFC 2195. + +;;; Code: + +(require 'ert) +(require 'sasl) +(require 'sasl-cram) + +(ert-deftest sasl-cram-md5-response-test () + ;; The following strings are taken from section 2 of RFC 2195. + (let ((client + (sasl-make-client (sasl-find-mechanism '("CRAM-MD5")) + "user" + "imap" + "localhost")) + (data (base64-decode-string "PDE4OTYuNjk3MTcwOTUyQHBvc3RvZmZpY2UucmVzdG9uLm1jaS5uZXQ+")) + (sasl-read-passphrase + (lambda (_prompt) (copy-sequence "tanstaaftanstaaf")))) + (should (equal (sasl-cram-md5-response client (vector nil data)) + "user b913a602c7eda7a495b4e6e7334d3890")))) + +(provide 'sasl-cram-tests) +;;; sasl-cram-tests.el ends here diff --git a/test/lisp/net/sasl-tests.el b/test/lisp/net/sasl-tests.el new file mode 100644 index 00000000000..dab40754c00 --- /dev/null +++ b/test/lisp/net/sasl-tests.el @@ -0,0 +1,59 @@ +;;; sasl-tests.el --- tests for sasl.el -*- lexical-binding: t; -*- + +;; Copyright (C) 2021 Free Software Foundation, Inc. + +;; Author: Stefan Kangas <stefankangas@gmail.com> + +;; This file is part of GNU Emacs. + +;; GNU Emacs is free software: you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. + +;; GNU Emacs is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. + +;;; Commentary: + +;;; Code: + +(require 'ert) +(require 'sasl) + +(ert-deftest sasl-test-make-client () + (let ((client (sasl-make-client 'foo 'bar 'baz 'zut))) + (should (eq (sasl-client-mechanism client) 'foo)) + (should (eq (sasl-client-name client) 'bar)) + (should (eq (sasl-client-service client) 'baz)) + (should (eq (sasl-client-server client) 'zut)))) + +(ert-deftest sasl-test-client-set-properties () + (let ((client (sasl-make-client 'foo 'bar 'baz 'zut))) + (sasl-client-set-property client 'foo 'bar) + (should (eq (sasl-client-property client 'foo) 'bar)))) + +(ert-deftest sasl-test-step-data () + (let ((step [nil nil])) + (sasl-step-set-data step "foo") + (should (equal (sasl-step-data step) "foo")))) + +(ert-deftest sasl-test-unique-id () + (should (stringp (sasl-unique-id))) + (should-not (equal (sasl-unique-id) (sasl-unique-id)))) + +(ert-deftest sasl-test-find-mechanism () + (should (sasl-find-mechanism '("ANONYMOUS"))) + (should-not (sasl-find-mechanism '("nonexistent mechanism")))) + +(ert-deftest sasl-test-mechanism-name () + (let ((mechanism (sasl-find-mechanism '("ANONYMOUS")))) + (should (equal (sasl-mechanism-name mechanism) "ANONYMOUS")))) + +(provide 'sasl-tests) +;;; sasl-tests.el ends here diff --git a/test/lisp/net/tramp-tests.el b/test/lisp/net/tramp-tests.el index 5deee658296..19a40fdf06c 100644 --- a/test/lisp/net/tramp-tests.el +++ b/test/lisp/net/tramp-tests.el @@ -3192,6 +3192,8 @@ This tests also `file-directory-p' and `file-accessible-directory-p'." (ert-deftest tramp-test17-insert-directory-one-file () "Check `insert-directory' inside directory listing." (skip-unless (tramp--test-enabled)) + ;; Relative file names in dired are not supported in tramp-crypt.el. + (skip-unless (not (tramp--test-crypt-p))) (dolist (quoted (if (tramp--test-expensive-test) '(nil t) '(nil))) (let* ((tmp-name1 @@ -5247,7 +5249,7 @@ Use direct async.") ;; order to avoid a question. `explicit-sh-args' echoes the ;; test data. (with-current-buffer (get-buffer-create "*shell*") - (ignore-errors (kill-process (current-buffer))) + (ignore-errors (kill-process (get-buffer-process (current-buffer)))) (should-not explicit-shell-file-name) (call-interactively #'shell) (with-timeout (10) @@ -5720,16 +5722,16 @@ This requires restrictions of file name syntax." (tramp-find-foreign-file-name-handler tramp-test-temporary-file-directory) 'tramp-ftp-file-name-handler)) +(defun tramp--test-crypt-p () + "Check, whether the remote directory is crypted" + (tramp-crypt-file-name-p tramp-test-temporary-file-directory)) + (defun tramp--test-docker-p () "Check, whether the docker method is used. This does not support some special file names." (string-equal "docker" (file-remote-p tramp-test-temporary-file-directory 'method))) -(defun tramp--test-crypt-p () - "Check, whether the remote directory is crypted" - (tramp-crypt-file-name-p tramp-test-temporary-file-directory)) - (defun tramp--test-ftp-p () "Check, whether an FTP-like method is used. This does not support globbing characters in file names (yet)." @@ -5748,7 +5750,7 @@ If optional METHOD is given, it is checked first." "Check, whether the remote host runs HP-UX. Several special characters do not work properly there." ;; We must refill the cache. `file-truename' does it. - (file-truename tramp-test-temporary-file-directory) nil + (file-truename tramp-test-temporary-file-directory) (string-match-p "^HP-UX" (tramp-get-connection-property tramp-test-vec "uname" ""))) @@ -5757,7 +5759,7 @@ Several special characters do not work properly there." ksh93 makes some strange conversions of non-latin characters into a $'' syntax." ;; We must refill the cache. `file-truename' does it. - (file-truename tramp-test-temporary-file-directory) nil + (file-truename tramp-test-temporary-file-directory) (string-match-p "ksh$" (tramp-get-connection-property tramp-test-vec "remote-shell" ""))) @@ -5787,6 +5789,17 @@ This does not support special file names." "Check, whether the remote host runs a based method from tramp-sh.el." (tramp-sh-file-name-handler-p tramp-test-vec)) +(defun tramp--test-sh-no-ls--dired-p () + "Check, whether the remote host runs a based method from tramp-sh.el. +Additionally, ls does not support \"--dired\"." + (and (tramp--test-sh-p) + (with-temp-buffer + ;; We must refill the cache. `insert-directory' does it. + ;; This fails for tramp-crypt.el, so we ignore that. + (ignore-errors + (insert-directory tramp-test-temporary-file-directory "-al")) + (not (tramp-get-connection-property tramp-test-vec "ls--dired" nil))))) + (defun tramp--test-share-p () "Check, whether the method needs a share." (and (tramp--test-gvfs-p) @@ -6023,17 +6036,20 @@ This requires restrictions of file name syntax." ;; expanded to <TAB>. (let ((files (list - (if (or (tramp--test-ange-ftp-p) - (tramp--test-gvfs-p) - (tramp--test-rclone-p) - (tramp--test-sudoedit-p) - (tramp--test-windows-nt-or-smb-p)) - "foo bar baz" - (if (or (tramp--test-adb-p) - (tramp--test-docker-p) - (eq system-type 'cygwin)) - " foo bar baz " - " foo\tbar baz\t")) + (cond ((or (tramp--test-ange-ftp-p) + (tramp--test-docker-p) + (tramp--test-gvfs-p) + (tramp--test-rclone-p) + (tramp--test-sudoedit-p) + (tramp--test-windows-nt-or-smb-p)) + "foo bar baz") + ((or (tramp--test-adb-p) + (eq system-type 'cygwin)) + " foo bar baz ") + ((tramp--test-sh-no-ls--dired-p) + "\tfoo bar baz\t") + (t " foo\tbar baz\t")) + "@foo@bar@baz@" "$foo$bar$$baz$" "-foo-bar-baz-" "%foo%bar%baz%" diff --git a/test/lisp/progmodes/asm-mode-tests.el b/test/lisp/progmodes/asm-mode-tests.el index 6ae4fdf5850..87872179d93 100644 --- a/test/lisp/progmodes/asm-mode-tests.el +++ b/test/lisp/progmodes/asm-mode-tests.el @@ -69,4 +69,14 @@ (should (string-match-p ";;; \nlabel:" (buffer-string))) (should (= (current-column) 4)))) +(ert-deftest asm-mode-tests-fill-comment () + (asm-mode-tests--with-temp-buffer + (call-interactively #'comment-dwim) + (insert "Pellentesque condimentum, magna ut suscipit hendrerit, \ +ipsum augue ornare nulla, non luctus diam neque sit amet urna.") + (call-interactively #'fill-paragraph) + (should (equal (buffer-string) "\t;; Pellentesque condimentum, \ +magna ut suscipit hendrerit,\n\t;; ipsum augue ornare nulla, non \ +luctus diam neque sit amet\n\t;; urna.")))) + ;;; asm-mode-tests.el ends here diff --git a/test/lisp/progmodes/elisp-mode-tests.el b/test/lisp/progmodes/elisp-mode-tests.el index fd43707f277..badcad670c2 100644 --- a/test/lisp/progmodes/elisp-mode-tests.el +++ b/test/lisp/progmodes/elisp-mode-tests.el @@ -834,5 +834,61 @@ to (xref-elisp-test-descr-to-target xref)." (indent-region (point-min) (point-max)) (should (equal (buffer-string) orig))))) +(defun test--font (form search) + (with-temp-buffer + (emacs-lisp-mode) + (if (stringp form) + (insert form) + (pp form (current-buffer))) + (font-lock-debug-fontify) + (goto-char (point-min)) + (and (re-search-forward search nil t) + (get-text-property (match-beginning 1) 'face)))) + +(ert-deftest test-elisp-font-keywords-1 () + ;; Special form. + (should (eq (test--font '(if foo bar) "(\\(if\\)") + 'font-lock-keyword-face)) + ;; Macro. + (should (eq (test--font '(when foo bar) "(\\(when\\)") + 'font-lock-keyword-face)) + (should (eq (test--font '(condition-case nil + (foo) + (error (if a b))) + "(\\(if\\)") + 'font-lock-keyword-face)) + (should (eq (test--font '(condition-case nil + (foo) + (when (if a b))) + "(\\(when\\)") + 'nil))) + +(ert-deftest test-elisp-font-keywords-2 () + (should (eq (test--font '(condition-case nil + (foo) + (error (when a b))) + "(\\(when\\)") + 'font-lock-keyword-face))) + +(ert-deftest test-elisp-font-keywords-3 () + (should (eq (test--font '(setq a '(if when zot)) + "(\\(if\\)") + nil))) + +(ert-deftest test-elisp-font-keywords-4 () + :expected-result :failed ; FIXME bug#43265 + (should (eq (test--font '(condition-case nil + (foo) + ((if foo) (when a b))) + "(\\(if\\)") + nil))) + +(ert-deftest test-elisp-font-keywords-5 () + (should (eq (test--font '(condition-case (when a) + (foo) + (error t)) + "(\\(when\\)") + nil))) + (provide 'elisp-mode-tests) ;;; elisp-mode-tests.el ends here diff --git a/test/lisp/thingatpt-tests.el b/test/lisp/thingatpt-tests.el index c43c81af9fd..62a27f09cbd 100644 --- a/test/lisp/thingatpt-tests.el +++ b/test/lisp/thingatpt-tests.el @@ -146,4 +146,48 @@ position to retrieve THING.") (should (thing-at-point-looking-at "2abcd")) (should (equal (match-data) m2))))) +(ert-deftest test-symbol-thing-1 () + (with-temp-buffer + (insert "foo bar zot") + (goto-char 4) + (should (eq (symbol-at-point) 'foo)) + (forward-char 1) + (should (eq (symbol-at-point) 'bar)) + (forward-char 1) + (should (eq (symbol-at-point) 'bar)) + (forward-char 1) + (should (eq (symbol-at-point) 'bar)) + (forward-char 1) + (should (eq (symbol-at-point) 'bar)) + (forward-char 1) + (should (eq (symbol-at-point) 'zot)))) + +(ert-deftest test-symbol-thing-2 () + (with-temp-buffer + (insert " bar ") + (goto-char (point-max)) + (should (eq (symbol-at-point) nil)) + (forward-char -1) + (should (eq (symbol-at-point) 'bar)))) + +(ert-deftest test-symbol-thing-2 () + (with-temp-buffer + (insert " bar ") + (goto-char (point-max)) + (should (eq (symbol-at-point) nil)) + (forward-char -1) + (should (eq (symbol-at-point) 'bar)))) + +(ert-deftest test-symbol-thing-3 () + (with-temp-buffer + (insert "bar") + (goto-char 2) + (should (eq (symbol-at-point) 'bar)))) + +(ert-deftest test-symbol-thing-3 () + (with-temp-buffer + (insert "`[[`(") + (goto-char 2) + (should (eq (symbol-at-point) nil)))) + ;;; thingatpt.el ends here diff --git a/test/manual/indent/shell.sh b/test/manual/indent/shell.sh index dc184ea0d77..bd4a74f7054 100755 --- a/test/manual/indent/shell.sh +++ b/test/manual/indent/shell.sh @@ -6,6 +6,13 @@ setlock -n /tmp/getmail.lock && echo getmail isn\'t running toto=$(grep hello foo | wc) +myfun () { + for ((it=0; it<${limit}; ++it)) + { + echo "whatever $it" + } +} + # adsgsdg if foo; then diff --git a/test/src/process-tests.el b/test/src/process-tests.el index 949f73595b4..a3fba8d328b 100644 --- a/test/src/process-tests.el +++ b/test/src/process-tests.el @@ -789,6 +789,36 @@ have written output." (should (equal calls (list (list process "finished\n")))))))))) +(ert-deftest process-tests/multiple-threads-waiting () + (skip-unless (fboundp 'make-thread)) + (with-timeout (60 (ert-fail "Test timed out")) + (process-tests--with-processes processes + (let ((threads ()) + (cat (executable-find "cat"))) + (skip-unless cat) + (dotimes (i 10) + (let* ((name (format "test %d" i)) + (process (make-process :name name + :command (list cat) + :coding 'no-conversion + :noquery t + :connection-type 'pipe))) + (push process processes) + (set-process-thread process nil) + (push (make-thread + (lambda () + (while (accept-process-output process))) + name) + threads))) + (mapc #'process-send-eof processes) + (cl-loop for process in processes + and thread in threads + do + (should-not (thread-join thread)) + (should-not (thread-last-error)) + (should (eq (process-status process) 'exit)) + (should (eql (process-exit-status process) 0))))))) + (defun process-tests--eval (command form) "Return a command that evaluates FORM in an Emacs subprocess. COMMAND must be a list returned by |