diff options
| author | YAMAMOTO Mitsuharu | 2019-04-27 18:33:39 +0900 |
|---|---|---|
| committer | YAMAMOTO Mitsuharu | 2019-04-27 18:33:39 +0900 |
| commit | 886bedb36c7b959b7e6fc8ce8e0c04e144b0ae28 (patch) | |
| tree | b5770d9fc10a704ad8aeb3474c6940121252c770 /test/src | |
| parent | 015a6e1df2772bd43680df5cbeaffccf98a881da (diff) | |
| parent | 8dc00b2f1e6523c634df3e24379afbe712a32b27 (diff) | |
| download | emacs-886bedb36c7b959b7e6fc8ce8e0c04e144b0ae28.tar.gz emacs-886bedb36c7b959b7e6fc8ce8e0c04e144b0ae28.zip | |
Merge branch 'master' into harfbuzz
Diffstat (limited to 'test/src')
36 files changed, 308 insertions, 52 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 @@ | |||
| 1 | ;;; alloc-tests.el --- alloc tests -*- lexical-binding: t -*- | 1 | ;;; alloc-tests.el --- alloc tests -*- lexical-binding: t -*- |
| 2 | 2 | ||
| 3 | ;; Copyright (C) 2015-2018 Free Software Foundation, Inc. | 3 | ;; Copyright (C) 2015-2019 Free Software Foundation, Inc. |
| 4 | 4 | ||
| 5 | ;; Author: Daniel Colascione <dancol@dancol.org> | 5 | ;; Author: Daniel Colascione <dancol@dancol.org> |
| 6 | ;; Keywords: | 6 | ;; 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 @@ | |||
| 1 | ;;; buffer-tests.el --- tests for buffer.c functions -*- lexical-binding: t -*- | 1 | ;;; buffer-tests.el --- tests for buffer.c functions -*- lexical-binding: t -*- |
| 2 | 2 | ||
| 3 | ;; Copyright (C) 2015-2018 Free Software Foundation, Inc. | 3 | ;; Copyright (C) 2015-2019 Free Software Foundation, Inc. |
| 4 | 4 | ||
| 5 | ;; This file is part of GNU Emacs. | 5 | ;; This file is part of GNU Emacs. |
| 6 | 6 | ||
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 @@ | |||
| 1 | ;;; callint-tests.el --- unit tests for callint.c -*- lexical-binding: t; -*- | 1 | ;;; callint-tests.el --- unit tests for callint.c -*- lexical-binding: t; -*- |
| 2 | 2 | ||
| 3 | ;; Copyright (C) 2018 Free Software Foundation, Inc. | 3 | ;; Copyright (C) 2018-2019 Free Software Foundation, Inc. |
| 4 | 4 | ||
| 5 | ;; Author: Philipp Stephani <phst@google.com> | 5 | ;; Author: Philipp Stephani <phst@google.com> |
| 6 | 6 | ||
diff --git a/test/src/callproc-tests.el b/test/src/callproc-tests.el index 481116ee5b2..1cad8360dea 100644 --- a/test/src/callproc-tests.el +++ b/test/src/callproc-tests.el | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | ;;; callproc-tests.el --- callproc.c tests -*- lexical-binding: t -*- | 1 | ;;; callproc-tests.el --- callproc.c tests -*- lexical-binding: t -*- |
| 2 | 2 | ||
| 3 | ;; Copyright (C) 2016-2018 Free Software Foundation, Inc. | 3 | ;; Copyright (C) 2016-2019 Free Software Foundation, Inc. |
| 4 | 4 | ||
| 5 | ;; This file is part of GNU Emacs. | 5 | ;; This file is part of GNU Emacs. |
| 6 | 6 | ||
| @@ -37,3 +37,26 @@ | |||
| 37 | (split-string-and-unquote (buffer-string))) | 37 | (split-string-and-unquote (buffer-string))) |
| 38 | (should (equal initial-shell "nil")) | 38 | (should (equal initial-shell "nil")) |
| 39 | (should-not (equal initial-shell shell)))) | 39 | (should-not (equal initial-shell shell)))) |
| 40 | |||
| 41 | (ert-deftest call-process-w32-debug-spawn-error () | ||
| 42 | "Check that debugger runs on `call-process' failure (Bug#33016)." | ||
| 43 | (skip-unless (eq system-type 'windows-nt)) | ||
| 44 | (let* ((debug-on-error t) | ||
| 45 | (have-called-debugger nil) | ||
| 46 | (debugger (lambda (&rest _) | ||
| 47 | (setq have-called-debugger t) | ||
| 48 | ;; Allow entering the debugger later in the same | ||
| 49 | ;; test run, before going back to the command | ||
| 50 | ;; loop. | ||
| 51 | (setq internal-when-entered-debugger -1)))) | ||
| 52 | (should (eq :got-error ;; NOTE: `should-error' would inhibit debugger. | ||
| 53 | (condition-case-unless-debug () | ||
| 54 | ;; On MS-Windows, "nul.FOO" resolves to the null | ||
| 55 | ;; device, and thus acts like an always-empty | ||
| 56 | ;; file, for any FOO, in any directory. So | ||
| 57 | ;; c:/null.exe passes Emacs' test for the file's | ||
| 58 | ;; existence, and ensures we hit an error in the | ||
| 59 | ;; w32 process spawn code. | ||
| 60 | (call-process "c:/nul.exe") | ||
| 61 | (error :got-error)))) | ||
| 62 | (should have-called-debugger))) | ||
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 @@ | |||
| 1 | ;;; casefiddle-tests.el --- tests for casefiddle.c functions -*- lexical-binding: t -*- | 1 | ;;; casefiddle-tests.el --- tests for casefiddle.c functions -*- lexical-binding: t -*- |
| 2 | 2 | ||
| 3 | ;; Copyright (C) 2015-2016, 2018 Free Software Foundation, Inc. | 3 | ;; Copyright (C) 2015-2016, 2018-2019 Free Software Foundation, Inc. |
| 4 | 4 | ||
| 5 | ;; This file is part of GNU Emacs. | 5 | ;; This file is part of GNU Emacs. |
| 6 | 6 | ||
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 @@ | |||
| 1 | ;;; charset-tests.el --- Tests for charset.c | 1 | ;;; charset-tests.el --- Tests for charset.c |
| 2 | 2 | ||
| 3 | ;; Copyright 2017-2018 Free Software Foundation, Inc. | 3 | ;; Copyright 2017-2019 Free Software Foundation, Inc. |
| 4 | 4 | ||
| 5 | ;; This program is free software; you can redistribute it and/or modify | 5 | ;; This program is free software; you can redistribute it and/or modify |
| 6 | ;; it under the terms of the GNU General Public License as published by | 6 | ;; 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 @@ | |||
| 1 | ;;; chartab-tests.el --- Tests for char-tab.c | 1 | ;;; chartab-tests.el --- Tests for char-tab.c |
| 2 | 2 | ||
| 3 | ;; Copyright (C) 2016-2018 Free Software Foundation, Inc. | 3 | ;; Copyright (C) 2016-2019 Free Software Foundation, Inc. |
| 4 | 4 | ||
| 5 | ;; Author: Eli Zaretskii <eliz@gnu.org> | 5 | ;; Author: Eli Zaretskii <eliz@gnu.org> |
| 6 | 6 | ||
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 @@ | |||
| 1 | ;;; cmds-tests.el --- Testing some Emacs commands | 1 | ;;; cmds-tests.el --- Testing some Emacs commands |
| 2 | 2 | ||
| 3 | ;; Copyright (C) 2013-2018 Free Software Foundation, Inc. | 3 | ;; Copyright (C) 2013-2019 Free Software Foundation, Inc. |
| 4 | 4 | ||
| 5 | ;; Author: Nicolas Richard <youngfrog@members.fsf.org> | 5 | ;; Author: Nicolas Richard <youngfrog@members.fsf.org> |
| 6 | ;; Keywords: | 6 | ;; Keywords: |
| @@ -30,5 +30,13 @@ | |||
| 30 | (let ((last-command-event ?a)) | 30 | (let ((last-command-event ?a)) |
| 31 | (should-error (self-insert-command -1)))) | 31 | (should-error (self-insert-command -1)))) |
| 32 | 32 | ||
| 33 | (ert-deftest forward-line-with-bignum () | ||
| 34 | (with-temp-buffer | ||
| 35 | (insert "x\n") | ||
| 36 | (let ((shortage (forward-line (1- most-negative-fixnum)))) | ||
| 37 | (should (= shortage most-negative-fixnum))) | ||
| 38 | (let ((shortage (forward-line (+ 2 most-positive-fixnum)))) | ||
| 39 | (should (= shortage (1+ most-positive-fixnum)))))) | ||
| 40 | |||
| 33 | (provide 'cmds-tests) | 41 | (provide 'cmds-tests) |
| 34 | ;;; cmds-tests.el ends here | 42 | ;;; 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 @@ | |||
| 1 | ;;; coding-tests.el --- tests for text encoding and decoding | 1 | ;;; coding-tests.el --- tests for text encoding and decoding |
| 2 | 2 | ||
| 3 | ;; Copyright (C) 2013-2018 Free Software Foundation, Inc. | 3 | ;; Copyright (C) 2013-2019 Free Software Foundation, Inc. |
| 4 | 4 | ||
| 5 | ;; Author: Eli Zaretskii <eliz@gnu.org> | 5 | ;; Author: Eli Zaretskii <eliz@gnu.org> |
| 6 | ;; Author: Kenichi Handa <handa@gnu.org> | 6 | ;; Author: Kenichi Handa <handa@gnu.org> |
diff --git a/test/src/data-tests.el b/test/src/data-tests.el index d41c7623289..a9d48e29a8a 100644 --- a/test/src/data-tests.el +++ b/test/src/data-tests.el | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | ;;; data-tests.el --- tests for src/data.c -*- lexical-binding:t -*- | 1 | ;;; data-tests.el --- tests for src/data.c -*- lexical-binding:t -*- |
| 2 | 2 | ||
| 3 | ;; Copyright (C) 2013-2018 Free Software Foundation, Inc. | 3 | ;; Copyright (C) 2013-2019 Free Software Foundation, Inc. |
| 4 | 4 | ||
| 5 | ;; This file is part of GNU Emacs. | 5 | ;; This file is part of GNU Emacs. |
| 6 | 6 | ||
| @@ -656,6 +656,10 @@ comparing the subr with a much slower lisp implementation." | |||
| 656 | (ert-deftest data-tests-ash-lsh () | 656 | (ert-deftest data-tests-ash-lsh () |
| 657 | (should (= (ash most-negative-fixnum 1) | 657 | (should (= (ash most-negative-fixnum 1) |
| 658 | (* most-negative-fixnum 2))) | 658 | (* most-negative-fixnum 2))) |
| 659 | (should (= (ash 0 (* 2 most-positive-fixnum)) 0)) | ||
| 660 | (should (= (ash 1000 (* 2 most-negative-fixnum)) 0)) | ||
| 661 | (should (= (ash -1000 (* 2 most-negative-fixnum)) -1)) | ||
| 662 | (should (= (ash (* 2 most-negative-fixnum) (* 2 most-negative-fixnum)) -1)) | ||
| 659 | (should (= (lsh most-negative-fixnum 1) | 663 | (should (= (lsh most-negative-fixnum 1) |
| 660 | (* most-negative-fixnum 2))) | 664 | (* most-negative-fixnum 2))) |
| 661 | (should (= (ash (* 2 most-negative-fixnum) -1) | 665 | (should (= (ash (* 2 most-negative-fixnum) -1) |
| @@ -665,4 +669,22 @@ comparing the subr with a much slower lisp implementation." | |||
| 665 | (should (= (lsh -1 -1) most-positive-fixnum)) | 669 | (should (= (lsh -1 -1) most-positive-fixnum)) |
| 666 | (should-error (lsh (1- most-negative-fixnum) -1))) | 670 | (should-error (lsh (1- most-negative-fixnum) -1))) |
| 667 | 671 | ||
| 672 | (ert-deftest data-tests-make-local-forwarded-var () ;bug#34318 | ||
| 673 | ;; Boy, this bug is tricky to trigger. You need to: | ||
| 674 | ;; - call make-local-variable on a forwarded var (i.e. one that | ||
| 675 | ;; has a corresponding C var linked via DEFVAR_(LISP|INT|BOOL)) | ||
| 676 | ;; - cause the C code to modify this variable from the C side of the | ||
| 677 | ;; forwarding, but this needs to happen before the var is accessed | ||
| 678 | ;; from the Lisp side and before we switch to another buffer. | ||
| 679 | ;; The trigger in bug#34318 doesn't exist any more because the C code has | ||
| 680 | ;; changes. Instead I found the trigger below. | ||
| 681 | (with-temp-buffer | ||
| 682 | (setq last-coding-system-used 'bug34318) | ||
| 683 | (make-local-variable 'last-coding-system-used) | ||
| 684 | ;; This should set last-coding-system-used to `no-conversion'. | ||
| 685 | (decode-coding-string "hello" nil) | ||
| 686 | (should (equal (list last-coding-system-used | ||
| 687 | (default-value 'last-coding-system-used)) | ||
| 688 | '(no-conversion bug34318))))) | ||
| 689 | |||
| 668 | ;;; data-tests.el ends here | 690 | ;;; 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 @@ | |||
| 1 | ;;; decompress-tests.el --- Test suite for decompress. | 1 | ;;; decompress-tests.el --- Test suite for decompress. |
| 2 | 2 | ||
| 3 | ;; Copyright (C) 2013-2018 Free Software Foundation, Inc. | 3 | ;; Copyright (C) 2013-2019 Free Software Foundation, Inc. |
| 4 | 4 | ||
| 5 | ;; Author: Lars Ingebrigtsen <larsi@gnus.org> | 5 | ;; Author: Lars Ingebrigtsen <larsi@gnus.org> |
| 6 | 6 | ||
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 @@ | |||
| 1 | ;;; doc-tests.el --- Tests for doc.c | 1 | ;;; doc-tests.el --- Tests for doc.c |
| 2 | 2 | ||
| 3 | ;; Copyright (C) 2016-2018 Free Software Foundation, Inc. | 3 | ;; Copyright (C) 2016-2019 Free Software Foundation, Inc. |
| 4 | 4 | ||
| 5 | ;; Author: Eli Zaretskii <eliz@gnu.org> | 5 | ;; Author: Eli Zaretskii <eliz@gnu.org> |
| 6 | 6 | ||
diff --git a/test/src/editfns-tests.el b/test/src/editfns-tests.el index 66375a64333..1e8b7066d15 100644 --- a/test/src/editfns-tests.el +++ b/test/src/editfns-tests.el | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | ;;; editfns-tests.el -- tests for editfns.c | 1 | ;;; editfns-tests.el -- tests for editfns.c |
| 2 | 2 | ||
| 3 | ;; Copyright (C) 2016-2018 Free Software Foundation, Inc. | 3 | ;; Copyright (C) 2016-2019 Free Software Foundation, Inc. |
| 4 | 4 | ||
| 5 | ;; This file is part of GNU Emacs. | 5 | ;; This file is part of GNU Emacs. |
| 6 | 6 | ||
| @@ -184,12 +184,11 @@ | |||
| 184 | 'integer)) | 184 | 'integer)) |
| 185 | (should (eq (type-of (read (format "#32rG%x" most-positive-fixnum))) | 185 | (should (eq (type-of (read (format "#32rG%x" most-positive-fixnum))) |
| 186 | 'integer)) | 186 | 'integer)) |
| 187 | (let ((binary-as-unsigned nil)) | 187 | (dolist (fmt '("%d" "%s" "#o%o" "#x%x")) |
| 188 | (dolist (fmt '("%d" "%s" "#o%o" "#x%x")) | 188 | (dolist (val (list most-negative-fixnum (1+ most-negative-fixnum) |
| 189 | (dolist (val (list most-negative-fixnum (1+ most-negative-fixnum) | 189 | -1 0 1 |
| 190 | -1 0 1 | 190 | (1- most-positive-fixnum) most-positive-fixnum)) |
| 191 | (1- most-positive-fixnum) most-positive-fixnum)) | 191 | (should (eq val (read (format fmt val))))))) |
| 192 | (should (eq val (read (format fmt val)))))))) | ||
| 193 | 192 | ||
| 194 | (ert-deftest format-%o-invalid-float () | 193 | (ert-deftest format-%o-invalid-float () |
| 195 | (should-error (format "%o" -1e-37) | 194 | (should-error (format "%o" -1e-37) |
| @@ -352,6 +351,9 @@ | |||
| 352 | "-0x000000003ffffffffffffffe000000000000000 ")))) | 351 | "-0x000000003ffffffffffffffe000000000000000 ")))) |
| 353 | 352 | ||
| 354 | (ert-deftest test-group-name () | 353 | (ert-deftest test-group-name () |
| 354 | ;; FIXME: Actually my GID in one of my systems has no associated entry | ||
| 355 | ;; in /etc/group so there's no name for it and `group-name' correctly | ||
| 356 | ;; returns nil! | ||
| 355 | (should (stringp (group-name (group-gid)))) | 357 | (should (stringp (group-name (group-gid)))) |
| 356 | (should-error (group-name 'foo)) | 358 | (should-error (group-name 'foo)) |
| 357 | (cond | 359 | (cond |
| @@ -373,4 +375,13 @@ | |||
| 373 | ((eq stat 2) | 375 | ((eq stat 2) |
| 374 | (should-not name))))))))) | 376 | (should-not name))))))))) |
| 375 | 377 | ||
| 378 | (ert-deftest test-translate-region-internal () | ||
| 379 | (with-temp-buffer | ||
| 380 | (let ((max-char #16r3FFFFF) | ||
| 381 | (tt (make-char-table 'translation-table))) | ||
| 382 | (aset tt max-char ?*) | ||
| 383 | (insert max-char) | ||
| 384 | (translate-region-internal (point-min) (point-max) tt) | ||
| 385 | (should (string-equal (buffer-string) "*"))))) | ||
| 386 | |||
| 376 | ;;; editfns-tests.el ends here | 387 | ;;; editfns-tests.el ends here |
diff --git a/test/src/emacs-module-tests.el b/test/src/emacs-module-tests.el index c67190be5cb..173b63670fc 100644 --- a/test/src/emacs-module-tests.el +++ b/test/src/emacs-module-tests.el | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | ;;; Test GNU Emacs modules. | 1 | ;;; Test GNU Emacs modules. |
| 2 | 2 | ||
| 3 | ;; Copyright 2015-2018 Free Software Foundation, Inc. | 3 | ;; Copyright 2015-2019 Free Software Foundation, Inc. |
| 4 | 4 | ||
| 5 | ;; This file is part of GNU Emacs. | 5 | ;; This file is part of GNU Emacs. |
| 6 | 6 | ||
| @@ -265,7 +265,8 @@ during garbage collection." | |||
| 265 | (skip-unless (file-executable-p mod-test-emacs)) | 265 | (skip-unless (file-executable-p mod-test-emacs)) |
| 266 | (module--test-assertion | 266 | (module--test-assertion |
| 267 | (rx "Module function called during garbage collection\n") | 267 | (rx "Module function called during garbage collection\n") |
| 268 | (mod-test-invalid-finalizer))) | 268 | (mod-test-invalid-finalizer) |
| 269 | (garbage-collect))) | ||
| 269 | 270 | ||
| 270 | (ert-deftest module/describe-function-1 () | 271 | (ert-deftest module/describe-function-1 () |
| 271 | "Check that Bug#30163 is fixed." | 272 | "Check that Bug#30163 is fixed." |
| @@ -289,4 +290,82 @@ Return A + B" | |||
| 289 | (should (member '(provide . mod-test) entries)) | 290 | (should (member '(provide . mod-test) entries)) |
| 290 | (should (member '(defun . mod-test-sum) entries)))) | 291 | (should (member '(defun . mod-test-sum) entries)))) |
| 291 | 292 | ||
| 293 | (ert-deftest mod-test-sleep-until () | ||
| 294 | "Check that `mod-test-sleep-until' either returns normally or quits. | ||
| 295 | Interactively, you can try hitting \\[keyboard-quit] to quit." | ||
| 296 | (dolist (arg '(nil t)) | ||
| 297 | ;; Guard against some caller setting `inhibit-quit'. | ||
| 298 | (with-local-quit | ||
| 299 | (condition-case nil | ||
| 300 | (should (eq (with-local-quit | ||
| 301 | ;; Because `inhibit-quit' is nil here, the next | ||
| 302 | ;; form either quits or returns `finished'. | ||
| 303 | (mod-test-sleep-until | ||
| 304 | ;; Interactively, run for 5 seconds to give the | ||
| 305 | ;; user time to quit. In batch mode, run only | ||
| 306 | ;; briefly since the user can't quit. | ||
| 307 | (float-time (time-add nil (if noninteractive 0.1 5))) | ||
| 308 | ;; should_quit or process_input | ||
| 309 | arg)) | ||
| 310 | 'finished)) | ||
| 311 | (quit))))) | ||
| 312 | |||
| 313 | (ert-deftest mod-test-add-nanosecond/valid () | ||
| 314 | (dolist (input (list | ||
| 315 | ;; Some realistic examples. | ||
| 316 | (current-time) (time-to-seconds) | ||
| 317 | (encode-time 12 34 5 6 7 2019 t) | ||
| 318 | ;; Various legacy timestamp forms. | ||
| 319 | '(123 456) '(123 456 789) '(123 456 789 6000) | ||
| 320 | ;; Corner case: this will result in a nanosecond | ||
| 321 | ;; value of 1000000000 after addition. The module | ||
| 322 | ;; code should handle this correctly. | ||
| 323 | '(123 65535 999999 999000) | ||
| 324 | ;; Seconds since the epoch. | ||
| 325 | 123 123.45 | ||
| 326 | ;; New (TICKS . HZ) format. | ||
| 327 | '(123456789 . 1000000000))) | ||
| 328 | (ert-info ((format "input: %s" input)) | ||
| 329 | (let ((result (mod-test-add-nanosecond input))) | ||
| 330 | (should (consp result)) | ||
| 331 | (should (integerp (car result))) | ||
| 332 | (should (integerp (cdr result))) | ||
| 333 | (should (cl-plusp (cdr result))) | ||
| 334 | (should (time-equal-p result (time-add input '(0 0 0 1000)))))))) | ||
| 335 | |||
| 336 | (ert-deftest mod-test-add-nanosecond/nil () | ||
| 337 | (should (<= (float-time (mod-test-add-nanosecond nil)) | ||
| 338 | (+ (float-time) 1e-9)))) | ||
| 339 | |||
| 340 | (ert-deftest mod-test-add-nanosecond/invalid () | ||
| 341 | (dolist (input '(1.0e+INF 1.0e-INF 0.0e+NaN (123) (123.45 6 7) "foo" [1 2])) | ||
| 342 | (ert-info ((format "input: %s" input)) | ||
| 343 | (should-error (mod-test-add-nanosecond input))))) | ||
| 344 | |||
| 345 | (ert-deftest mod-test-nanoseconds () | ||
| 346 | "Test truncation when converting to `struct timespec'." | ||
| 347 | (dolist (test-case '((0 . 0) | ||
| 348 | (-1 . -1000000000) | ||
| 349 | ((1 . 1000000000) . 1) | ||
| 350 | ((-1 . 1000000000) . -1) | ||
| 351 | ((1 . 1000000000000) . 0) | ||
| 352 | ((-1 . 1000000000000) . -1) | ||
| 353 | ((999 . 1000000000000) . 0) | ||
| 354 | ((-999 . 1000000000000) . -1) | ||
| 355 | ((1000 . 1000000000000) . 1) | ||
| 356 | ((-1000 . 1000000000000) . -1) | ||
| 357 | ((0 0 0 1) . 0) | ||
| 358 | ((0 0 0 -1) . -1))) | ||
| 359 | (let ((input (car test-case)) | ||
| 360 | (expected (cdr test-case))) | ||
| 361 | (ert-info ((format "input: %S, expected result: %d" input expected)) | ||
| 362 | (should (eq (mod-test-nanoseconds input) expected)))))) | ||
| 363 | |||
| 364 | (ert-deftest mod-test-double () | ||
| 365 | (dolist (input (list 0 1 2 -1 42 12345678901234567890 | ||
| 366 | most-positive-fixnum (1+ most-positive-fixnum) | ||
| 367 | most-negative-fixnum (1- most-negative-fixnum))) | ||
| 368 | (ert-info ((format "input: %d" input)) | ||
| 369 | (should (= (mod-test-double input) (* 2 input)))))) | ||
| 370 | |||
| 292 | ;;; emacs-module-tests.el ends here | 371 | ;;; 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 @@ | |||
| 1 | ;;; eval-tests.el --- unit tests for src/eval.c -*- lexical-binding: t; -*- | 1 | ;;; eval-tests.el --- unit tests for src/eval.c -*- lexical-binding: t; -*- |
| 2 | 2 | ||
| 3 | ;; Copyright (C) 2016-2018 Free Software Foundation, Inc. | 3 | ;; Copyright (C) 2016-2019 Free Software Foundation, Inc. |
| 4 | 4 | ||
| 5 | ;; Author: Philipp Stephani <phst@google.com> | 5 | ;; Author: Philipp Stephani <phst@google.com> |
| 6 | 6 | ||
diff --git a/test/src/fileio-tests.el b/test/src/fileio-tests.el index b7b78bbda09..6262d946df1 100644 --- a/test/src/fileio-tests.el +++ b/test/src/fileio-tests.el | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | ;;; unit tests for src/fileio.c -*- lexical-binding: t; -*- | 1 | ;;; unit tests for src/fileio.c -*- lexical-binding: t; -*- |
| 2 | 2 | ||
| 3 | ;; Copyright 2017-2018 Free Software Foundation, Inc. | 3 | ;; Copyright 2017-2019 Free Software Foundation, Inc. |
| 4 | 4 | ||
| 5 | ;; This file is part of GNU Emacs. | 5 | ;; This file is part of GNU Emacs. |
| 6 | 6 | ||
| @@ -102,4 +102,8 @@ Also check that an encoding error can appear in a symlink." | |||
| 102 | (setenv "HOME" "a/b/c") | 102 | (setenv "HOME" "a/b/c") |
| 103 | (should (equal (expand-file-name "~/foo") | 103 | (should (equal (expand-file-name "~/foo") |
| 104 | (expand-file-name "a/b/c/foo"))) | 104 | (expand-file-name "a/b/c/foo"))) |
| 105 | (when (memq system-type '(ms-dos windows-nt)) | ||
| 106 | ;; Test expansion of drive-relative file names. | ||
| 107 | (setenv "HOME" "x:foo") | ||
| 108 | (should (equal (expand-file-name "~/bar") "x:/foo/bar"))) | ||
| 105 | (setenv "HOME" old-home))) | 109 | (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 @@ | |||
| 1 | ;;; floatfns-tests.el --- tests for floating point operations | 1 | ;;; floatfns-tests.el --- tests for floating point operations |
| 2 | 2 | ||
| 3 | ;; Copyright 2017-2018 Free Software Foundation, Inc. | 3 | ;; Copyright 2017-2019 Free Software Foundation, Inc. |
| 4 | 4 | ||
| 5 | ;; This file is part of GNU Emacs. | 5 | ;; This file is part of GNU Emacs. |
| 6 | 6 | ||
diff --git a/test/src/fns-tests.el b/test/src/fns-tests.el index b180f30f285..6ebab4287f7 100644 --- a/test/src/fns-tests.el +++ b/test/src/fns-tests.el | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | ;;; fns-tests.el --- tests for src/fns.c | 1 | ;;; fns-tests.el --- tests for src/fns.c |
| 2 | 2 | ||
| 3 | ;; Copyright (C) 2014-2018 Free Software Foundation, Inc. | 3 | ;; Copyright (C) 2014-2019 Free Software Foundation, Inc. |
| 4 | 4 | ||
| 5 | ;; This file is part of GNU Emacs. | 5 | ;; This file is part of GNU Emacs. |
| 6 | 6 | ||
| @@ -161,7 +161,10 @@ | |||
| 161 | '(9 . "ppp") '(8 . "ttt") '(8 . "eee") '(9 . "fff")) | 161 | '(9 . "ppp") '(8 . "ttt") '(8 . "eee") '(9 . "fff")) |
| 162 | (lambda (x y) (< (car x) (car y)))) | 162 | (lambda (x y) (< (car x) (car y)))) |
| 163 | [(8 . "xxx") (8 . "bbb") (8 . "ttt") (8 . "eee") | 163 | [(8 . "xxx") (8 . "bbb") (8 . "ttt") (8 . "eee") |
| 164 | (9 . "aaa") (9 . "zzz") (9 . "ppp") (9 . "fff")]))) | 164 | (9 . "aaa") (9 . "zzz") (9 . "ppp") (9 . "fff")])) |
| 165 | ;; Bug#34104 | ||
| 166 | (should (equal (should-error (sort "cba" #'<) :type 'wrong-type-argument) | ||
| 167 | '(wrong-type-argument list-or-vector-p "cba")))) | ||
| 165 | 168 | ||
| 166 | (ert-deftest fns-tests-collate-sort () | 169 | (ert-deftest fns-tests-collate-sort () |
| 167 | (skip-unless (fns-tests--collate-enabled-p)) | 170 | (skip-unless (fns-tests--collate-enabled-p)) |
| @@ -645,4 +648,22 @@ | |||
| 645 | (should (equal (list (eq a b) n len) | 648 | (should (equal (list (eq a b) n len) |
| 646 | (list t n len)))))))) | 649 | (list t n len)))))))) |
| 647 | 650 | ||
| 651 | (ert-deftest test-proper-list-p () | ||
| 652 | "Test `proper-list-p' behavior." | ||
| 653 | (dotimes (length 4) | ||
| 654 | ;; Proper and dotted lists. | ||
| 655 | (let ((list (make-list length 0))) | ||
| 656 | (should (= (proper-list-p list) length)) | ||
| 657 | (should (not (proper-list-p (nconc list 0))))) | ||
| 658 | ;; Circular lists. | ||
| 659 | (dotimes (n (1+ length)) | ||
| 660 | (let ((circle (make-list (1+ length) 0))) | ||
| 661 | (should (not (proper-list-p (nconc circle (nthcdr n circle)))))))) | ||
| 662 | ;; Atoms. | ||
| 663 | (should (not (proper-list-p 0))) | ||
| 664 | (should (not (proper-list-p ""))) | ||
| 665 | (should (not (proper-list-p []))) | ||
| 666 | (should (not (proper-list-p (make-bool-vector 0 nil)))) | ||
| 667 | (should (not (proper-list-p (make-symbol "a"))))) | ||
| 668 | |||
| 648 | (provide 'fns-tests) | 669 | (provide 'fns-tests) |
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 @@ | |||
| 1 | ;;; font-tests.el --- Test suite for font-related functions. | 1 | ;;; font-tests.el --- Test suite for font-related functions. |
| 2 | 2 | ||
| 3 | ;; Copyright (C) 2011-2018 Free Software Foundation, Inc. | 3 | ;; Copyright (C) 2011-2019 Free Software Foundation, Inc. |
| 4 | 4 | ||
| 5 | ;; Author: Chong Yidong <cyd@stupidchicken.com> | 5 | ;; Author: Chong Yidong <cyd@stupidchicken.com> |
| 6 | ;; Keywords: internal | 6 | ;; 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 @@ | |||
| 1 | ;;; inotify-tests.el --- Test suite for inotify. -*- lexical-binding: t -*- | 1 | ;;; inotify-tests.el --- Test suite for inotify. -*- lexical-binding: t -*- |
| 2 | 2 | ||
| 3 | ;; Copyright (C) 2012-2018 Free Software Foundation, Inc. | 3 | ;; Copyright (C) 2012-2019 Free Software Foundation, Inc. |
| 4 | 4 | ||
| 5 | ;; Author: Rüdiger Sonderfeld <ruediger@c-plusplus.de> | 5 | ;; Author: Rüdiger Sonderfeld <ruediger@c-plusplus.de> |
| 6 | ;; Keywords: internal | 6 | ;; Keywords: internal |
diff --git a/test/src/json-tests.el b/test/src/json-tests.el index 651b0a0bb7a..7d824b5c953 100644 --- a/test/src/json-tests.el +++ b/test/src/json-tests.el | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | ;;; json-tests.el --- unit tests for json.c -*- lexical-binding: t; -*- | 1 | ;;; json-tests.el --- unit tests for json.c -*- lexical-binding: t; -*- |
| 2 | 2 | ||
| 3 | ;; Copyright (C) 2017-2018 Free Software Foundation, Inc. | 3 | ;; Copyright (C) 2017-2019 Free Software Foundation, Inc. |
| 4 | 4 | ||
| 5 | ;; This file is part of GNU Emacs. | 5 | ;; This file is part of GNU Emacs. |
| 6 | 6 | ||
| @@ -117,6 +117,14 @@ | |||
| 117 | (should (equal (json-parse-string input :object-type 'plist) | 117 | (should (equal (json-parse-string input :object-type 'plist) |
| 118 | '(:abc [9 :false] :def :null))))) | 118 | '(:abc [9 :false] :def :null))))) |
| 119 | 119 | ||
| 120 | (ert-deftest json-parse-string/array () | ||
| 121 | (skip-unless (fboundp 'json-parse-string)) | ||
| 122 | (let ((input "[\"a\", 1, [\"b\", 2]]")) | ||
| 123 | (should (equal (json-parse-string input) | ||
| 124 | ["a" 1 ["b" 2]])) | ||
| 125 | (should (equal (json-parse-string input :array-type 'list) | ||
| 126 | '("a" 1 ("b" 2)))))) | ||
| 127 | |||
| 120 | (ert-deftest json-parse-string/string () | 128 | (ert-deftest json-parse-string/string () |
| 121 | (skip-unless (fboundp 'json-parse-string)) | 129 | (skip-unless (fboundp 'json-parse-string)) |
| 122 | (should-error (json-parse-string "[\"formfeed\f\"]") :type 'json-parse-error) | 130 | (should-error (json-parse-string "[\"formfeed\f\"]") :type 'json-parse-error) |
| @@ -151,7 +159,7 @@ | |||
| 151 | (skip-unless (fboundp 'json-parse-string)) | 159 | (skip-unless (fboundp 'json-parse-string)) |
| 152 | (should-error (json-parse-string "\x00") :type 'wrong-type-argument) | 160 | (should-error (json-parse-string "\x00") :type 'wrong-type-argument) |
| 153 | ;; FIXME: Reconsider whether this is the right behavior. | 161 | ;; FIXME: Reconsider whether this is the right behavior. |
| 154 | (should-error (json-parse-string "[a\\u0000b]") :type 'json-parse-error)) | 162 | (should-error (json-parse-string "[\"a\\u0000b\"]") :type 'json-parse-error)) |
| 155 | 163 | ||
| 156 | (ert-deftest json-parse-string/invalid-unicode () | 164 | (ert-deftest json-parse-string/invalid-unicode () |
| 157 | "Some examples from | 165 | "Some examples from |
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 @@ | |||
| 1 | ;;; keyboard-tests.el --- Tests for keyboard.c -*- lexical-binding: t -*- | 1 | ;;; keyboard-tests.el --- Tests for keyboard.c -*- lexical-binding: t -*- |
| 2 | 2 | ||
| 3 | ;; Copyright (C) 2017-2018 Free Software Foundation, Inc. | 3 | ;; Copyright (C) 2017-2019 Free Software Foundation, Inc. |
| 4 | 4 | ||
| 5 | ;; This file is part of GNU Emacs. | 5 | ;; This file is part of GNU Emacs. |
| 6 | 6 | ||
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 @@ | |||
| 1 | ;;; keymap-tests.el --- Test suite for src/keymap.c | 1 | ;;; keymap-tests.el --- Test suite for src/keymap.c |
| 2 | 2 | ||
| 3 | ;; Copyright (C) 2015-2018 Free Software Foundation, Inc. | 3 | ;; Copyright (C) 2015-2019 Free Software Foundation, Inc. |
| 4 | 4 | ||
| 5 | ;; Author: Juanma Barranquero <lekktu@gmail.com> | 5 | ;; Author: Juanma Barranquero <lekktu@gmail.com> |
| 6 | 6 | ||
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 @@ | |||
| 1 | ;;; lcms-tests.el --- tests for Little CMS interface -*- lexical-binding: t -*- | 1 | ;;; lcms-tests.el --- tests for Little CMS interface -*- lexical-binding: t -*- |
| 2 | 2 | ||
| 3 | ;; Copyright (C) 2017-2018 Free Software Foundation, Inc. | 3 | ;; Copyright (C) 2017-2019 Free Software Foundation, Inc. |
| 4 | 4 | ||
| 5 | ;; Maintainer: emacs-devel@gnu.org | 5 | ;; Maintainer: emacs-devel@gnu.org |
| 6 | 6 | ||
diff --git a/test/src/lread-tests.el b/test/src/lread-tests.el index f19d98320ab..82b75b195ca 100644 --- a/test/src/lread-tests.el +++ b/test/src/lread-tests.el | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | ;;; lread-tests.el --- tests for lread.c -*- lexical-binding: t; -*- | 1 | ;;; lread-tests.el --- tests for lread.c -*- lexical-binding: t; -*- |
| 2 | 2 | ||
| 3 | ;; Copyright (C) 2016-2018 Free Software Foundation, Inc. | 3 | ;; Copyright (C) 2016-2019 Free Software Foundation, Inc. |
| 4 | 4 | ||
| 5 | ;; Author: Philipp Stephani <phst@google.com> | 5 | ;; Author: Philipp Stephani <phst@google.com> |
| 6 | 6 | ||
| @@ -140,7 +140,9 @@ literals (Bug#20852)." | |||
| 140 | (should (equal (lread-tests--last-message) | 140 | (should (equal (lread-tests--last-message) |
| 141 | (concat (format-message "Loading `%s': " file-name) | 141 | (concat (format-message "Loading `%s': " file-name) |
| 142 | "unescaped character literals " | 142 | "unescaped character literals " |
| 143 | "`?\"', `?(', `?)', `?;', `?[', `?]' detected!"))))) | 143 | "`?\"', `?(', `?)', `?;', `?[', `?]' detected, " |
| 144 | "`?\\\"', `?\\(', `?\\)', `?\\;', `?\\[', `?\\]' " | ||
| 145 | "expected!"))))) | ||
| 144 | 146 | ||
| 145 | (ert-deftest lread-tests--funny-quote-symbols () | 147 | (ert-deftest lread-tests--funny-quote-symbols () |
| 146 | "Check that 'smart quotes' or similar trigger errors in symbol names." | 148 | "Check that 'smart quotes' or similar trigger errors in symbol names." |
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 @@ | |||
| 1 | ;;; marker-tests.el --- tests for marker.c functions -*- lexical-binding: t -*- | 1 | ;;; marker-tests.el --- tests for marker.c functions -*- lexical-binding: t -*- |
| 2 | 2 | ||
| 3 | ;; Copyright (C) 2016-2018 Free Software Foundation, Inc. | 3 | ;; Copyright (C) 2016-2019 Free Software Foundation, Inc. |
| 4 | 4 | ||
| 5 | ;; This file is part of GNU Emacs. | 5 | ;; This file is part of GNU Emacs. |
| 6 | 6 | ||
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 @@ | |||
| 1 | ;;; minibuf-tests.el --- tests for minibuf.c functions -*- lexical-binding: t -*- | 1 | ;;; minibuf-tests.el --- tests for minibuf.c functions -*- lexical-binding: t -*- |
| 2 | 2 | ||
| 3 | ;; Copyright (C) 2016-2018 Free Software Foundation, Inc. | 3 | ;; Copyright (C) 2016-2019 Free Software Foundation, Inc. |
| 4 | 4 | ||
| 5 | ;; This file is part of GNU Emacs. | 5 | ;; This file is part of GNU Emacs. |
| 6 | 6 | ||
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 @@ | |||
| 1 | ;;; print-tests.el --- tests for src/print.c -*- lexical-binding: t; -*- | 1 | ;;; print-tests.el --- tests for src/print.c -*- lexical-binding: t; -*- |
| 2 | 2 | ||
| 3 | ;; Copyright (C) 2014-2018 Free Software Foundation, Inc. | 3 | ;; Copyright (C) 2014-2019 Free Software Foundation, Inc. |
| 4 | 4 | ||
| 5 | ;; This file is part of GNU Emacs. | 5 | ;; This file is part of GNU Emacs. |
| 6 | 6 | ||
diff --git a/test/src/process-tests.el b/test/src/process-tests.el index 551b34ff371..b853f77946d 100644 --- a/test/src/process-tests.el +++ b/test/src/process-tests.el | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | ;;; process-tests.el --- Testing the process facilities | 1 | ;;; process-tests.el --- Testing the process facilities |
| 2 | 2 | ||
| 3 | ;; Copyright (C) 2013-2018 Free Software Foundation, Inc. | 3 | ;; Copyright (C) 2013-2019 Free Software Foundation, Inc. |
| 4 | 4 | ||
| 5 | ;; This program is free software; you can redistribute it and/or modify | 5 | ;; This program is free software; you can redistribute it and/or modify |
| 6 | ;; it under the terms of the GNU General Public License as published by | 6 | ;; it under the terms of the GNU General Public License as published by |
| @@ -207,13 +207,91 @@ | |||
| 207 | :sentinel #'ignore | 207 | :sentinel #'ignore |
| 208 | :noquery t | 208 | :noquery t |
| 209 | :connection-type 'pipe))) | 209 | :connection-type 'pipe))) |
| 210 | (while (process-live-p process) | 210 | (while (or (accept-process-output process) |
| 211 | (accept-process-output process)) | 211 | (process-live-p process))) |
| 212 | (should (eq (process-status process) 'exit)) | 212 | (should (eq (process-status process) 'exit)) |
| 213 | (should (eq (process-exit-status process) 0)) | 213 | (should (eq (process-exit-status process) 0)) |
| 214 | (should (process-tests--mixable (string-to-list (buffer-string)) | 214 | (should (process-tests--mixable (string-to-list (buffer-string)) |
| 215 | (string-to-list "stdout\n") | 215 | (string-to-list "stdout\n") |
| 216 | (string-to-list "stderr\n")))))) | 216 | (string-to-list "stderr\n")))))) |
| 217 | 217 | ||
| 218 | (ert-deftest make-process-w32-debug-spawn-error () | ||
| 219 | "Check that debugger runs on `make-process' failure (Bug#33016)." | ||
| 220 | (skip-unless (eq system-type 'windows-nt)) | ||
| 221 | (let* ((debug-on-error t) | ||
| 222 | (have-called-debugger nil) | ||
| 223 | (debugger (lambda (&rest _) | ||
| 224 | (setq have-called-debugger t) | ||
| 225 | ;; Allow entering the debugger later in the same | ||
| 226 | ;; test run, before going back to the command | ||
| 227 | ;; loop. | ||
| 228 | (setq internal-when-entered-debugger -1)))) | ||
| 229 | (should (eq :got-error ;; NOTE: `should-error' would inhibit debugger. | ||
| 230 | (condition-case-unless-debug () | ||
| 231 | ;; Emacs doesn't search for absolute filenames, so | ||
| 232 | ;; the error will be hit in the w32 process spawn | ||
| 233 | ;; code. | ||
| 234 | (make-process :name "test" :command '("c:/No-Such-Command")) | ||
| 235 | (error :got-error)))) | ||
| 236 | (should have-called-debugger))) | ||
| 237 | |||
| 238 | (ert-deftest make-process/file-handler/found () | ||
| 239 | "Check that the ‘:file-handler’ argument of ‘make-process’ | ||
| 240 | works as expected if a file name handler is found." | ||
| 241 | (let ((file-handler-calls 0)) | ||
| 242 | (cl-flet ((file-handler | ||
| 243 | (&rest args) | ||
| 244 | (should (equal default-directory "test-handler:/dir/")) | ||
| 245 | (should (equal args '(make-process :name "name" | ||
| 246 | :command ("/some/binary") | ||
| 247 | :file-handler t))) | ||
| 248 | (cl-incf file-handler-calls) | ||
| 249 | 'fake-process)) | ||
| 250 | (let ((file-name-handler-alist (list (cons (rx bos "test-handler:") | ||
| 251 | #'file-handler))) | ||
| 252 | (default-directory "test-handler:/dir/")) | ||
| 253 | (should (eq (make-process :name "name" | ||
| 254 | :command '("/some/binary") | ||
| 255 | :file-handler t) | ||
| 256 | 'fake-process)) | ||
| 257 | (should (= file-handler-calls 1)))))) | ||
| 258 | |||
| 259 | (ert-deftest make-process/file-handler/not-found () | ||
| 260 | "Check that the ‘:file-handler’ argument of ‘make-process’ | ||
| 261 | works as expected if no file name handler is found." | ||
| 262 | (let ((file-name-handler-alist ()) | ||
| 263 | (default-directory invocation-directory) | ||
| 264 | (program (expand-file-name invocation-name invocation-directory))) | ||
| 265 | (should (processp (make-process :name "name" | ||
| 266 | :command (list program "--version") | ||
| 267 | :file-handler t))))) | ||
| 268 | |||
| 269 | (ert-deftest make-process/file-handler/disable () | ||
| 270 | "Check ‘make-process’ works as expected if it shouldn’t use the | ||
| 271 | file name handler." | ||
| 272 | (let ((file-name-handler-alist (list (cons (rx bos "test-handler:") | ||
| 273 | #'process-tests--file-handler))) | ||
| 274 | (default-directory "test-handler:/dir/") | ||
| 275 | (program (expand-file-name invocation-name invocation-directory))) | ||
| 276 | (should (processp (make-process :name "name" | ||
| 277 | :command (list program "--version")))))) | ||
| 278 | |||
| 279 | (defun process-tests--file-handler (operation &rest _args) | ||
| 280 | (cl-ecase operation | ||
| 281 | (unhandled-file-name-directory "/") | ||
| 282 | (make-process (ert-fail "file name handler called unexpectedly")))) | ||
| 283 | |||
| 284 | (put #'process-tests--file-handler 'operations | ||
| 285 | '(unhandled-file-name-directory make-process)) | ||
| 286 | |||
| 287 | (ert-deftest make-process/stop () | ||
| 288 | "Check that `make-process' doesn't accept a `:stop' key. | ||
| 289 | See Bug#30460." | ||
| 290 | (should-error | ||
| 291 | (make-process :name "test" | ||
| 292 | :command (list (expand-file-name invocation-name | ||
| 293 | invocation-directory)) | ||
| 294 | :stop t))) | ||
| 295 | |||
| 218 | (provide 'process-tests) | 296 | (provide 'process-tests) |
| 219 | ;; process-tests.el ends here. | 297 | ;; 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 @@ | |||
| 1 | ;;; regex-emacs-tests.el --- tests for regex-emacs.c -*- lexical-binding: t -*- | 1 | ;;; regex-emacs-tests.el --- tests for regex-emacs.c -*- lexical-binding: t -*- |
| 2 | 2 | ||
| 3 | ;; Copyright (C) 2015-2018 Free Software Foundation, Inc. | 3 | ;; Copyright (C) 2015-2019 Free Software Foundation, Inc. |
| 4 | 4 | ||
| 5 | ;; This file is part of GNU Emacs. | 5 | ;; This file is part of GNU Emacs. |
| 6 | 6 | ||
| @@ -278,7 +278,7 @@ on success" | |||
| 278 | 278 | ||
| 279 | 279 | ||
| 280 | (defconst regex-tests-re-even-escapes | 280 | (defconst regex-tests-re-even-escapes |
| 281 | "\\(?:^\\|[^\\\\]\\)\\(?:\\\\\\\\\\)*" | 281 | "\\(?:^\\|[^\\]\\)\\(?:\\\\\\\\\\)*" |
| 282 | "Regex that matches an even number of \\ characters") | 282 | "Regex that matches an even number of \\ characters") |
| 283 | 283 | ||
| 284 | (defconst regex-tests-re-odd-escapes | 284 | (defconst regex-tests-re-odd-escapes |
| @@ -555,11 +555,11 @@ differences in behavior.") | |||
| 555 | 555 | ||
| 556 | (defconst regex-tests-PTESTS-whitelist | 556 | (defconst regex-tests-PTESTS-whitelist |
| 557 | [ | 557 | [ |
| 558 | ;; emacs doesn't barf on weird ranges such as [b-a], but simply | 558 | ;; emacs doesn't see DEL (0x7f) as a [:cntrl:] character |
| 559 | ;; fails to match | ||
| 560 | 138 | 559 | 138 |
| 561 | 560 | ||
| 562 | ;; emacs doesn't see DEL (0x78) as a [:cntrl:] character | 561 | ;; emacs doesn't barf on weird ranges such as [b-a], but simply |
| 562 | ;; fails to match | ||
| 563 | 168 | 563 | 168 |
| 564 | ] | 564 | ] |
| 565 | "Line numbers in the PTESTS test that should be skipped. These | 565 | "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 @@ | |||
| 1 | ;;; syntax-tests.el --- tests for syntax.c functions -*- lexical-binding: t -*- | 1 | ;;; syntax-tests.el --- tests for syntax.c functions -*- lexical-binding: t -*- |
| 2 | 2 | ||
| 3 | ;; Copyright (C) 2017-2018 Free Software Foundation, Inc. | 3 | ;; Copyright (C) 2017-2019 Free Software Foundation, Inc. |
| 4 | 4 | ||
| 5 | ;; This file is part of GNU Emacs. | 5 | ;; This file is part of GNU Emacs. |
| 6 | 6 | ||
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 @@ | |||
| 1 | ;;; textprop-tests.el --- Test suite for text properties. | 1 | ;;; textprop-tests.el --- Test suite for text properties. |
| 2 | 2 | ||
| 3 | ;; Copyright (C) 2015-2018 Free Software Foundation, Inc. | 3 | ;; Copyright (C) 2015-2019 Free Software Foundation, Inc. |
| 4 | 4 | ||
| 5 | ;; Author: Wolfgang Jenkner <wjenkner@inode.at> | 5 | ;; Author: Wolfgang Jenkner <wjenkner@inode.at> |
| 6 | ;; Keywords: internal | 6 | ;; 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 @@ | |||
| 1 | ;;; threads.el --- tests for threads. | 1 | ;;; threads.el --- tests for threads. |
| 2 | 2 | ||
| 3 | ;; Copyright (C) 2012-2018 Free Software Foundation, Inc. | 3 | ;; Copyright (C) 2012-2019 Free Software Foundation, Inc. |
| 4 | 4 | ||
| 5 | ;; This file is part of GNU Emacs. | 5 | ;; This file is part of GNU Emacs. |
| 6 | 6 | ||
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 @@ | |||
| 1 | ;;; timefns-tests.el -- tests for timefns.c | 1 | ;;; timefns-tests.el -- tests for timefns.c |
| 2 | 2 | ||
| 3 | ;; Copyright (C) 2016-2018 Free Software Foundation, Inc. | 3 | ;; Copyright (C) 2016-2019 Free Software Foundation, Inc. |
| 4 | 4 | ||
| 5 | ;; This file is part of GNU Emacs. | 5 | ;; This file is part of GNU Emacs. |
| 6 | 6 | ||
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 @@ | |||
| 1 | ;;; undo-tests.el --- Tests of primitive-undo | 1 | ;;; undo-tests.el --- Tests of primitive-undo |
| 2 | 2 | ||
| 3 | ;; Copyright (C) 2012-2018 Free Software Foundation, Inc. | 3 | ;; Copyright (C) 2012-2019 Free Software Foundation, Inc. |
| 4 | 4 | ||
| 5 | ;; Author: Aaron S. Hawley <aaron.s.hawley@gmail.com> | 5 | ;; Author: Aaron S. Hawley <aaron.s.hawley@gmail.com> |
| 6 | 6 | ||
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 @@ | |||
| 1 | ;;; libxml-parse-tests.el --- Test suite for libxml parsing. | 1 | ;;; libxml-parse-tests.el --- Test suite for libxml parsing. |
| 2 | 2 | ||
| 3 | ;; Copyright (C) 2014-2018 Free Software Foundation, Inc. | 3 | ;; Copyright (C) 2014-2019 Free Software Foundation, Inc. |
| 4 | 4 | ||
| 5 | ;; Author: Ulf Jasper <ulf.jasper@web.de> | 5 | ;; Author: Ulf Jasper <ulf.jasper@web.de> |
| 6 | ;; Keywords: internal | 6 | ;; Keywords: internal |