diff options
Diffstat (limited to 'test/src')
36 files changed, 199 insertions, 54 deletions
diff --git a/test/src/alloc-tests.el b/test/src/alloc-tests.el index 21166afa3ca..32acc5140b8 100644 --- a/test/src/alloc-tests.el +++ b/test/src/alloc-tests.el @@ -1,6 +1,6 @@ ;;; alloc-tests.el --- alloc tests -*- lexical-binding: t -*- -;; Copyright (C) 2015-2018 Free Software Foundation, Inc. +;; Copyright (C) 2015-2019 Free Software Foundation, Inc. ;; Author: Daniel Colascione <dancol@dancol.org> ;; Keywords: diff --git a/test/src/buffer-tests.el b/test/src/buffer-tests.el index 609585f43ed..845d41f9d60 100644 --- a/test/src/buffer-tests.el +++ b/test/src/buffer-tests.el @@ -1,6 +1,6 @@ ;;; buffer-tests.el --- tests for buffer.c functions -*- lexical-binding: t -*- -;; Copyright (C) 2015-2018 Free Software Foundation, Inc. +;; Copyright (C) 2015-2019 Free Software Foundation, Inc. ;; This file is part of GNU Emacs. diff --git a/test/src/callint-tests.el b/test/src/callint-tests.el index feee9b692b7..5c310b5c08d 100644 --- a/test/src/callint-tests.el +++ b/test/src/callint-tests.el @@ -1,6 +1,6 @@ ;;; callint-tests.el --- unit tests for callint.c -*- lexical-binding: t; -*- -;; Copyright (C) 2018 Free Software Foundation, Inc. +;; Copyright (C) 2018-2019 Free Software Foundation, Inc. ;; Author: Philipp Stephani <phst@google.com> diff --git a/test/src/callproc-tests.el b/test/src/callproc-tests.el index 481116ee5b2..7b30a251cce 100644 --- a/test/src/callproc-tests.el +++ b/test/src/callproc-tests.el @@ -1,6 +1,6 @@ ;;; callproc-tests.el --- callproc.c tests -*- lexical-binding: t -*- -;; Copyright (C) 2016-2018 Free Software Foundation, Inc. +;; Copyright (C) 2016-2019 Free Software Foundation, Inc. ;; This file is part of GNU Emacs. diff --git a/test/src/casefiddle-tests.el b/test/src/casefiddle-tests.el index 5d8798c984f..ed9a2f93306 100644 --- a/test/src/casefiddle-tests.el +++ b/test/src/casefiddle-tests.el @@ -1,6 +1,6 @@ ;;; casefiddle-tests.el --- tests for casefiddle.c functions -*- lexical-binding: t -*- -;; Copyright (C) 2015-2016, 2018 Free Software Foundation, Inc. +;; Copyright (C) 2015-2016, 2018-2019 Free Software Foundation, Inc. ;; This file is part of GNU Emacs. diff --git a/test/src/charset-tests.el b/test/src/charset-tests.el index c1eec6932cb..3bf673917bc 100644 --- a/test/src/charset-tests.el +++ b/test/src/charset-tests.el @@ -1,6 +1,6 @@ ;;; charset-tests.el --- Tests for charset.c -;; Copyright 2017-2018 Free Software Foundation, Inc. +;; Copyright 2017-2019 Free Software Foundation, Inc. ;; This program is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by diff --git a/test/src/chartab-tests.el b/test/src/chartab-tests.el index bda97017e55..11dd1cbf2a8 100644 --- a/test/src/chartab-tests.el +++ b/test/src/chartab-tests.el @@ -1,6 +1,6 @@ ;;; chartab-tests.el --- Tests for char-tab.c -;; Copyright (C) 2016-2018 Free Software Foundation, Inc. +;; Copyright (C) 2016-2019 Free Software Foundation, Inc. ;; Author: Eli Zaretskii <eliz@gnu.org> diff --git a/test/src/cmds-tests.el b/test/src/cmds-tests.el index caf444cf877..bab8b5f26ec 100644 --- a/test/src/cmds-tests.el +++ b/test/src/cmds-tests.el @@ -1,6 +1,6 @@ ;;; cmds-tests.el --- Testing some Emacs commands -;; Copyright (C) 2013-2018 Free Software Foundation, Inc. +;; Copyright (C) 2013-2019 Free Software Foundation, Inc. ;; Author: Nicolas Richard <youngfrog@members.fsf.org> ;; Keywords: @@ -30,5 +30,13 @@ (let ((last-command-event ?a)) (should-error (self-insert-command -1)))) +(ert-deftest forward-line-with-bignum () + (with-temp-buffer + (insert "x\n") + (let ((shortage (forward-line (1- most-negative-fixnum)))) + (should (= shortage most-negative-fixnum))) + (let ((shortage (forward-line (+ 2 most-positive-fixnum)))) + (should (= shortage (1+ most-positive-fixnum)))))) + (provide 'cmds-tests) ;;; cmds-tests.el ends here diff --git a/test/src/coding-tests.el b/test/src/coding-tests.el index a3ca71514b0..1a08c1e1a18 100644 --- a/test/src/coding-tests.el +++ b/test/src/coding-tests.el @@ -1,6 +1,6 @@ ;;; coding-tests.el --- tests for text encoding and decoding -;; Copyright (C) 2013-2018 Free Software Foundation, Inc. +;; Copyright (C) 2013-2019 Free Software Foundation, Inc. ;; Author: Eli Zaretskii <eliz@gnu.org> ;; Author: Kenichi Handa <handa@gnu.org> diff --git a/test/src/data-tests.el b/test/src/data-tests.el index 3cd4802a981..a9d48e29a8a 100644 --- a/test/src/data-tests.el +++ b/test/src/data-tests.el @@ -1,6 +1,6 @@ ;;; data-tests.el --- tests for src/data.c -*- lexical-binding:t -*- -;; Copyright (C) 2013-2018 Free Software Foundation, Inc. +;; Copyright (C) 2013-2019 Free Software Foundation, Inc. ;; This file is part of GNU Emacs. @@ -484,7 +484,7 @@ comparing the subr with a much slower lisp implementation." (should-have-watch-data `(data-tests-lvar 3 set ,buf1))) (should-have-watch-data `(data-tests-lvar 1 unlet ,buf1)) (setq-default data-tests-lvar 4) - (should-have-watch-data `(data-tests-lvar 4 set nil)) + (should-have-watch-data '(data-tests-lvar 4 set nil)) (with-temp-buffer (setq buf2 (current-buffer)) (setq data-tests-lvar 1) @@ -501,7 +501,7 @@ comparing the subr with a much slower lisp implementation." (kill-all-local-variables) (should-have-watch-data `(data-tests-lvar nil makunbound ,buf2))) (setq-default data-tests-lvar 4) - (should-have-watch-data `(data-tests-lvar 4 set nil)) + (should-have-watch-data '(data-tests-lvar 4 set nil)) (makunbound 'data-tests-lvar) (should-have-watch-data '(data-tests-lvar nil makunbound nil)) (setq data-tests-lvar 5) @@ -656,6 +656,10 @@ comparing the subr with a much slower lisp implementation." (ert-deftest data-tests-ash-lsh () (should (= (ash most-negative-fixnum 1) (* most-negative-fixnum 2))) + (should (= (ash 0 (* 2 most-positive-fixnum)) 0)) + (should (= (ash 1000 (* 2 most-negative-fixnum)) 0)) + (should (= (ash -1000 (* 2 most-negative-fixnum)) -1)) + (should (= (ash (* 2 most-negative-fixnum) (* 2 most-negative-fixnum)) -1)) (should (= (lsh most-negative-fixnum 1) (* most-negative-fixnum 2))) (should (= (ash (* 2 most-negative-fixnum) -1) @@ -665,4 +669,22 @@ comparing the subr with a much slower lisp implementation." (should (= (lsh -1 -1) most-positive-fixnum)) (should-error (lsh (1- most-negative-fixnum) -1))) +(ert-deftest data-tests-make-local-forwarded-var () ;bug#34318 + ;; Boy, this bug is tricky to trigger. You need to: + ;; - call make-local-variable on a forwarded var (i.e. one that + ;; has a corresponding C var linked via DEFVAR_(LISP|INT|BOOL)) + ;; - cause the C code to modify this variable from the C side of the + ;; forwarding, but this needs to happen before the var is accessed + ;; from the Lisp side and before we switch to another buffer. + ;; The trigger in bug#34318 doesn't exist any more because the C code has + ;; changes. Instead I found the trigger below. + (with-temp-buffer + (setq last-coding-system-used 'bug34318) + (make-local-variable 'last-coding-system-used) + ;; This should set last-coding-system-used to `no-conversion'. + (decode-coding-string "hello" nil) + (should (equal (list last-coding-system-used + (default-value 'last-coding-system-used)) + '(no-conversion bug34318))))) + ;;; data-tests.el ends here diff --git a/test/src/decompress-tests.el b/test/src/decompress-tests.el index 647dbebc7d9..50d947b4e17 100644 --- a/test/src/decompress-tests.el +++ b/test/src/decompress-tests.el @@ -1,6 +1,6 @@ ;;; decompress-tests.el --- Test suite for decompress. -;; Copyright (C) 2013-2018 Free Software Foundation, Inc. +;; Copyright (C) 2013-2019 Free Software Foundation, Inc. ;; Author: Lars Ingebrigtsen <larsi@gnus.org> diff --git a/test/src/doc-tests.el b/test/src/doc-tests.el index 7c075049aeb..9bcb240a580 100644 --- a/test/src/doc-tests.el +++ b/test/src/doc-tests.el @@ -1,6 +1,6 @@ ;;; doc-tests.el --- Tests for doc.c -;; Copyright (C) 2016-2018 Free Software Foundation, Inc. +;; Copyright (C) 2016-2019 Free Software Foundation, Inc. ;; Author: Eli Zaretskii <eliz@gnu.org> diff --git a/test/src/editfns-tests.el b/test/src/editfns-tests.el index 17b2c510734..449f00f3780 100644 --- a/test/src/editfns-tests.el +++ b/test/src/editfns-tests.el @@ -1,6 +1,6 @@ ;;; editfns-tests.el -- tests for editfns.c -;; Copyright (C) 2016-2018 Free Software Foundation, Inc. +;; Copyright (C) 2016-2019 Free Software Foundation, Inc. ;; This file is part of GNU Emacs. @@ -184,12 +184,11 @@ 'integer)) (should (eq (type-of (read (format "#32rG%x" most-positive-fixnum))) 'integer)) - (let ((binary-as-unsigned nil)) - (dolist (fmt '("%d" "%s" "#o%o" "#x%x")) - (dolist (val (list most-negative-fixnum (1+ most-negative-fixnum) - -1 0 1 - (1- most-positive-fixnum) most-positive-fixnum)) - (should (eq val (read (format fmt val)))))))) + (dolist (fmt '("%d" "%s" "#o%o" "#x%x")) + (dolist (val (list most-negative-fixnum (1+ most-negative-fixnum) + -1 0 1 + (1- most-positive-fixnum) most-positive-fixnum)) + (should (eq val (read (format fmt val))))))) (ert-deftest format-%o-invalid-float () (should-error (format "%o" -1e-37) @@ -351,4 +350,35 @@ (should (equal (format "%-#50.40x" v3) "-0x000000003ffffffffffffffe000000000000000 ")))) +(ert-deftest test-group-name () + (should (stringp (group-name (group-gid)))) + (should-error (group-name 'foo)) + (cond + ((memq system-type '(windows-nt ms-dos)) + (should-not (group-name 123456789))) + ((executable-find "getent") + (with-temp-buffer + (let (stat name) + (dolist (gid (list 0 1212345 (group-gid))) + (erase-buffer) + (setq stat (ignore-errors + (call-process "getent" nil '(t nil) nil "group" + (number-to-string gid)))) + (setq name (group-name gid)) + (goto-char (point-min)) + (cond ((eq stat 0) + (if (looking-at "\\([[:alnum:]_-]+\\):") + (should (string= (match-string 1) name)))) + ((eq stat 2) + (should-not name))))))))) + +(ert-deftest test-translate-region-internal () + (with-temp-buffer + (let ((max-char #16r3FFFFF) + (tt (make-char-table 'translation-table))) + (aset tt max-char ?*) + (insert max-char) + (translate-region-internal (point-min) (point-max) tt) + (should (string-equal (buffer-string) "*"))))) + ;;; editfns-tests.el ends here diff --git a/test/src/emacs-module-tests.el b/test/src/emacs-module-tests.el index c67190be5cb..35aaaa64b65 100644 --- a/test/src/emacs-module-tests.el +++ b/test/src/emacs-module-tests.el @@ -1,6 +1,6 @@ ;;; Test GNU Emacs modules. -;; Copyright 2015-2018 Free Software Foundation, Inc. +;; Copyright 2015-2019 Free Software Foundation, Inc. ;; This file is part of GNU Emacs. @@ -265,7 +265,8 @@ during garbage collection." (skip-unless (file-executable-p mod-test-emacs)) (module--test-assertion (rx "Module function called during garbage collection\n") - (mod-test-invalid-finalizer))) + (mod-test-invalid-finalizer) + (garbage-collect))) (ert-deftest module/describe-function-1 () "Check that Bug#30163 is fixed." @@ -289,4 +290,24 @@ Return A + B" (should (member '(provide . mod-test) entries)) (should (member '(defun . mod-test-sum) entries)))) +(ert-deftest mod-test-sleep-until () + "Check that `mod-test-sleep-until' either returns normally or quits. +Interactively, you can try hitting \\[keyboard-quit] to quit." + (dolist (arg '(nil t)) + ;; Guard against some caller setting `inhibit-quit'. + (with-local-quit + (condition-case nil + (should (eq (with-local-quit + ;; Because `inhibit-quit' is nil here, the next + ;; form either quits or returns `finished'. + (mod-test-sleep-until + ;; Interactively, run for 5 seconds to give the + ;; user time to quit. In batch mode, run only + ;; briefly since the user can't quit. + (float-time (time-add nil (if noninteractive 0.1 5))) + ;; should_quit or process_input + arg)) + 'finished)) + (quit))))) + ;;; emacs-module-tests.el ends here diff --git a/test/src/eval-tests.el b/test/src/eval-tests.el index 0c242913e7a..48295b81fa3 100644 --- a/test/src/eval-tests.el +++ b/test/src/eval-tests.el @@ -1,6 +1,6 @@ ;;; eval-tests.el --- unit tests for src/eval.c -*- lexical-binding: t; -*- -;; Copyright (C) 2016-2018 Free Software Foundation, Inc. +;; Copyright (C) 2016-2019 Free Software Foundation, Inc. ;; Author: Philipp Stephani <phst@google.com> diff --git a/test/src/fileio-tests.el b/test/src/fileio-tests.el index 5d12685fa19..6262d946df1 100644 --- a/test/src/fileio-tests.el +++ b/test/src/fileio-tests.el @@ -1,6 +1,6 @@ ;;; unit tests for src/fileio.c -*- lexical-binding: t; -*- -;; Copyright 2017-2018 Free Software Foundation, Inc. +;; Copyright 2017-2019 Free Software Foundation, Inc. ;; This file is part of GNU Emacs. @@ -95,3 +95,15 @@ Also check that an encoding error can appear in a symlink." (should (equal (file-name-as-directory "d:/abc/") "d:/abc/")) (should (equal (file-name-as-directory "D:\\abc/") "d:/abc/")) (should (equal (file-name-as-directory "D:/abc//") "d:/abc//"))) + +(ert-deftest fileio-tests--relative-HOME () + "Test that expand-file-name works even when HOME is relative." + (let ((old-home (getenv "HOME"))) + (setenv "HOME" "a/b/c") + (should (equal (expand-file-name "~/foo") + (expand-file-name "a/b/c/foo"))) + (when (memq system-type '(ms-dos windows-nt)) + ;; Test expansion of drive-relative file names. + (setenv "HOME" "x:foo") + (should (equal (expand-file-name "~/bar") "x:/foo/bar"))) + (setenv "HOME" old-home))) diff --git a/test/src/floatfns-tests.el b/test/src/floatfns-tests.el index 61b1c25743d..643866f1146 100644 --- a/test/src/floatfns-tests.el +++ b/test/src/floatfns-tests.el @@ -1,6 +1,6 @@ ;;; floatfns-tests.el --- tests for floating point operations -;; Copyright 2017-2018 Free Software Foundation, Inc. +;; Copyright 2017-2019 Free Software Foundation, Inc. ;; This file is part of GNU Emacs. diff --git a/test/src/fns-tests.el b/test/src/fns-tests.el index b180f30f285..d6cc99e8e33 100644 --- a/test/src/fns-tests.el +++ b/test/src/fns-tests.el @@ -1,6 +1,6 @@ ;;; fns-tests.el --- tests for src/fns.c -;; Copyright (C) 2014-2018 Free Software Foundation, Inc. +;; Copyright (C) 2014-2019 Free Software Foundation, Inc. ;; This file is part of GNU Emacs. @@ -161,7 +161,10 @@ '(9 . "ppp") '(8 . "ttt") '(8 . "eee") '(9 . "fff")) (lambda (x y) (< (car x) (car y)))) [(8 . "xxx") (8 . "bbb") (8 . "ttt") (8 . "eee") - (9 . "aaa") (9 . "zzz") (9 . "ppp") (9 . "fff")]))) + (9 . "aaa") (9 . "zzz") (9 . "ppp") (9 . "fff")])) + ;; Bug#34104 + (should (equal (should-error (sort "cba" #'<) :type 'wrong-type-argument) + '(wrong-type-argument list-or-vector-p "cba")))) (ert-deftest fns-tests-collate-sort () (skip-unless (fns-tests--collate-enabled-p)) diff --git a/test/src/font-tests.el b/test/src/font-tests.el index 70b32c8fd47..971d79d065f 100644 --- a/test/src/font-tests.el +++ b/test/src/font-tests.el @@ -1,6 +1,6 @@ ;;; font-tests.el --- Test suite for font-related functions. -;; Copyright (C) 2011-2018 Free Software Foundation, Inc. +;; Copyright (C) 2011-2019 Free Software Foundation, Inc. ;; Author: Chong Yidong <cyd@stupidchicken.com> ;; Keywords: internal diff --git a/test/src/inotify-tests.el b/test/src/inotify-tests.el index b46014e2734..06d6d65180f 100644 --- a/test/src/inotify-tests.el +++ b/test/src/inotify-tests.el @@ -1,6 +1,6 @@ ;;; inotify-tests.el --- Test suite for inotify. -*- lexical-binding: t -*- -;; Copyright (C) 2012-2018 Free Software Foundation, Inc. +;; Copyright (C) 2012-2019 Free Software Foundation, Inc. ;; Author: Rüdiger Sonderfeld <ruediger@c-plusplus.de> ;; Keywords: internal diff --git a/test/src/json-tests.el b/test/src/json-tests.el index bffee8f39d3..04f91f4abbc 100644 --- a/test/src/json-tests.el +++ b/test/src/json-tests.el @@ -1,6 +1,6 @@ ;;; json-tests.el --- unit tests for json.c -*- lexical-binding: t; -*- -;; Copyright (C) 2017-2018 Free Software Foundation, Inc. +;; Copyright (C) 2017-2019 Free Software Foundation, Inc. ;; This file is part of GNU Emacs. @@ -86,8 +86,8 @@ (should (equal (json-serialize (list :detect-hash-table #s(hash-table test equal data ("bla" "ble")) - :detect-alist `((bla . "ble")) - :detect-plist `(:bla "ble"))) + :detect-alist '((bla . "ble")) + :detect-plist '(:bla "ble"))) "\ {\ \"detect-hash-table\":{\"bla\":\"ble\"},\ diff --git a/test/src/keyboard-tests.el b/test/src/keyboard-tests.el index 125dbd09391..3e7d1313be6 100644 --- a/test/src/keyboard-tests.el +++ b/test/src/keyboard-tests.el @@ -1,6 +1,6 @@ ;;; keyboard-tests.el --- Tests for keyboard.c -*- lexical-binding: t -*- -;; Copyright (C) 2017-2018 Free Software Foundation, Inc. +;; Copyright (C) 2017-2019 Free Software Foundation, Inc. ;; This file is part of GNU Emacs. diff --git a/test/src/keymap-tests.el b/test/src/keymap-tests.el index 56ff4367d3d..d61f3046137 100644 --- a/test/src/keymap-tests.el +++ b/test/src/keymap-tests.el @@ -1,6 +1,6 @@ ;;; keymap-tests.el --- Test suite for src/keymap.c -;; Copyright (C) 2015-2018 Free Software Foundation, Inc. +;; Copyright (C) 2015-2019 Free Software Foundation, Inc. ;; Author: Juanma Barranquero <lekktu@gmail.com> diff --git a/test/src/lcms-tests.el b/test/src/lcms-tests.el index 28afd5a794a..f1d1110283d 100644 --- a/test/src/lcms-tests.el +++ b/test/src/lcms-tests.el @@ -1,6 +1,6 @@ ;;; lcms-tests.el --- tests for Little CMS interface -*- lexical-binding: t -*- -;; Copyright (C) 2017-2018 Free Software Foundation, Inc. +;; Copyright (C) 2017-2019 Free Software Foundation, Inc. ;; Maintainer: emacs-devel@gnu.org diff --git a/test/src/lread-tests.el b/test/src/lread-tests.el index f19d98320ab..ae918f03120 100644 --- a/test/src/lread-tests.el +++ b/test/src/lread-tests.el @@ -1,6 +1,6 @@ ;;; lread-tests.el --- tests for lread.c -*- lexical-binding: t; -*- -;; Copyright (C) 2016-2018 Free Software Foundation, Inc. +;; Copyright (C) 2016-2019 Free Software Foundation, Inc. ;; Author: Philipp Stephani <phst@google.com> diff --git a/test/src/marker-tests.el b/test/src/marker-tests.el index 859323e0fe1..79e298d8c27 100644 --- a/test/src/marker-tests.el +++ b/test/src/marker-tests.el @@ -1,6 +1,6 @@ ;;; marker-tests.el --- tests for marker.c functions -*- lexical-binding: t -*- -;; Copyright (C) 2016-2018 Free Software Foundation, Inc. +;; Copyright (C) 2016-2019 Free Software Foundation, Inc. ;; This file is part of GNU Emacs. diff --git a/test/src/minibuf-tests.el b/test/src/minibuf-tests.el index 5ee7e5c0d03..12b018b8228 100644 --- a/test/src/minibuf-tests.el +++ b/test/src/minibuf-tests.el @@ -1,6 +1,6 @@ ;;; minibuf-tests.el --- tests for minibuf.c functions -*- lexical-binding: t -*- -;; Copyright (C) 2016-2018 Free Software Foundation, Inc. +;; Copyright (C) 2016-2019 Free Software Foundation, Inc. ;; This file is part of GNU Emacs. diff --git a/test/src/print-tests.el b/test/src/print-tests.el index 78e769f50e9..8e377d71808 100644 --- a/test/src/print-tests.el +++ b/test/src/print-tests.el @@ -1,6 +1,6 @@ ;;; print-tests.el --- tests for src/print.c -*- lexical-binding: t; -*- -;; Copyright (C) 2014-2018 Free Software Foundation, Inc. +;; Copyright (C) 2014-2019 Free Software Foundation, Inc. ;; This file is part of GNU Emacs. diff --git a/test/src/process-tests.el b/test/src/process-tests.el index 551b34ff371..5dbf441e8c2 100644 --- a/test/src/process-tests.el +++ b/test/src/process-tests.el @@ -1,6 +1,6 @@ ;;; process-tests.el --- Testing the process facilities -;; Copyright (C) 2013-2018 Free Software Foundation, Inc. +;; Copyright (C) 2013-2019 Free Software Foundation, Inc. ;; This program is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by @@ -207,13 +207,62 @@ :sentinel #'ignore :noquery t :connection-type 'pipe))) - (while (process-live-p process) - (accept-process-output process)) + (while (or (accept-process-output process) + (process-live-p process))) (should (eq (process-status process) 'exit)) (should (eq (process-exit-status process) 0)) (should (process-tests--mixable (string-to-list (buffer-string)) (string-to-list "stdout\n") (string-to-list "stderr\n")))))) +(ert-deftest make-process/file-handler/found () + "Check that the ‘:file-handler’ argument of ‘make-process’ +works as expected if a file name handler is found." + (let ((file-handler-calls 0)) + (cl-flet ((file-handler + (&rest args) + (should (equal default-directory "test-handler:/dir/")) + (should (equal args '(make-process :name "name" + :command ("/some/binary") + :file-handler t))) + (cl-incf file-handler-calls) + 'fake-process)) + (let ((file-name-handler-alist (list (cons (rx bos "test-handler:") + #'file-handler))) + (default-directory "test-handler:/dir/")) + (should (eq (make-process :name "name" + :command '("/some/binary") + :file-handler t) + 'fake-process)) + (should (= file-handler-calls 1)))))) + +(ert-deftest make-process/file-handler/not-found () + "Check that the ‘:file-handler’ argument of ‘make-process’ +works as expected if no file name handler is found." + (let ((file-name-handler-alist ()) + (default-directory invocation-directory) + (program (expand-file-name invocation-name invocation-directory))) + (should (processp (make-process :name "name" + :command (list program "--version") + :file-handler t))))) + +(ert-deftest make-process/file-handler/disable () + "Check ‘make-process’ works as expected if it shouldn’t use the +file name handler." + (let ((file-name-handler-alist (list (cons (rx bos "test-handler:") + #'process-tests--file-handler))) + (default-directory "test-handler:/dir/") + (program (expand-file-name invocation-name invocation-directory))) + (should (processp (make-process :name "name" + :command (list program "--version")))))) + +(defun process-tests--file-handler (operation &rest _args) + (cl-ecase operation + (unhandled-file-name-directory "/") + (make-process (ert-fail "file name handler called unexpectedly")))) + +(put #'process-tests--file-handler 'operations + '(unhandled-file-name-directory make-process)) + (provide 'process-tests) ;; process-tests.el ends here. diff --git a/test/src/regex-emacs-tests.el b/test/src/regex-emacs-tests.el index 7a075908a6b..0ae50c94d4c 100644 --- a/test/src/regex-emacs-tests.el +++ b/test/src/regex-emacs-tests.el @@ -1,6 +1,6 @@ ;;; regex-emacs-tests.el --- tests for regex-emacs.c -*- lexical-binding: t -*- -;; Copyright (C) 2015-2018 Free Software Foundation, Inc. +;; Copyright (C) 2015-2019 Free Software Foundation, Inc. ;; This file is part of GNU Emacs. @@ -278,7 +278,7 @@ on success" (defconst regex-tests-re-even-escapes - "\\(?:^\\|[^\\\\]\\)\\(?:\\\\\\\\\\)*" + "\\(?:^\\|[^\\]\\)\\(?:\\\\\\\\\\)*" "Regex that matches an even number of \\ characters") (defconst regex-tests-re-odd-escapes @@ -555,11 +555,11 @@ differences in behavior.") (defconst regex-tests-PTESTS-whitelist [ - ;; emacs doesn't barf on weird ranges such as [b-a], but simply - ;; fails to match + ;; emacs doesn't see DEL (0x7f) as a [:cntrl:] character 138 - ;; emacs doesn't see DEL (0x78) as a [:cntrl:] character + ;; emacs doesn't barf on weird ranges such as [b-a], but simply + ;; fails to match 168 ] "Line numbers in the PTESTS test that should be skipped. These diff --git a/test/src/syntax-tests.el b/test/src/syntax-tests.el index 4057d75c0a7..3c3245f2a33 100644 --- a/test/src/syntax-tests.el +++ b/test/src/syntax-tests.el @@ -1,6 +1,6 @@ ;;; syntax-tests.el --- tests for syntax.c functions -*- lexical-binding: t -*- -;; Copyright (C) 2017-2018 Free Software Foundation, Inc. +;; Copyright (C) 2017-2019 Free Software Foundation, Inc. ;; This file is part of GNU Emacs. diff --git a/test/src/textprop-tests.el b/test/src/textprop-tests.el index 11cb9e14f19..db7256f5346 100644 --- a/test/src/textprop-tests.el +++ b/test/src/textprop-tests.el @@ -1,6 +1,6 @@ ;;; textprop-tests.el --- Test suite for text properties. -;; Copyright (C) 2015-2018 Free Software Foundation, Inc. +;; Copyright (C) 2015-2019 Free Software Foundation, Inc. ;; Author: Wolfgang Jenkner <wjenkner@inode.at> ;; Keywords: internal diff --git a/test/src/thread-tests.el b/test/src/thread-tests.el index 36bb6377901..5e5bfd155fb 100644 --- a/test/src/thread-tests.el +++ b/test/src/thread-tests.el @@ -1,6 +1,6 @@ ;;; threads.el --- tests for threads. -;; Copyright (C) 2012-2018 Free Software Foundation, Inc. +;; Copyright (C) 2012-2019 Free Software Foundation, Inc. ;; This file is part of GNU Emacs. diff --git a/test/src/timefns-tests.el b/test/src/timefns-tests.el index ebeb43de163..5c858ef3bd8 100644 --- a/test/src/timefns-tests.el +++ b/test/src/timefns-tests.el @@ -1,6 +1,6 @@ ;;; timefns-tests.el -- tests for timefns.c -;; Copyright (C) 2016-2018 Free Software Foundation, Inc. +;; Copyright (C) 2016-2019 Free Software Foundation, Inc. ;; This file is part of GNU Emacs. diff --git a/test/src/undo-tests.el b/test/src/undo-tests.el index dab3619ad89..b84f5a58471 100644 --- a/test/src/undo-tests.el +++ b/test/src/undo-tests.el @@ -1,6 +1,6 @@ ;;; undo-tests.el --- Tests of primitive-undo -;; Copyright (C) 2012-2018 Free Software Foundation, Inc. +;; Copyright (C) 2012-2019 Free Software Foundation, Inc. ;; Author: Aaron S. Hawley <aaron.s.hawley@gmail.com> diff --git a/test/src/xml-tests.el b/test/src/xml-tests.el index c1d65b9d124..aa7a71e37cc 100644 --- a/test/src/xml-tests.el +++ b/test/src/xml-tests.el @@ -1,6 +1,6 @@ ;;; libxml-parse-tests.el --- Test suite for libxml parsing. -;; Copyright (C) 2014-2018 Free Software Foundation, Inc. +;; Copyright (C) 2014-2019 Free Software Foundation, Inc. ;; Author: Ulf Jasper <ulf.jasper@web.de> ;; Keywords: internal |