diff options
| author | Michael R. Mauger | 2017-04-02 18:10:57 -0400 |
|---|---|---|
| committer | Michael R. Mauger | 2017-04-02 18:10:57 -0400 |
| commit | 77083e2d34ba5559ae2899d3b03cf08c2e6c5ad4 (patch) | |
| tree | 27da92c2a61d664b700860c2d527a4d36000ca37 /test/lisp | |
| parent | c5a31f8292c94d19b80a3dbe0b3026693cc1090e (diff) | |
| parent | 8e394a7f35c2ba9297d222faa2689e177f268924 (diff) | |
| download | emacs-77083e2d34ba5559ae2899d3b03cf08c2e6c5ad4.tar.gz emacs-77083e2d34ba5559ae2899d3b03cf08c2e6c5ad4.zip | |
Merge branch 'master' of git.sv.gnu.org:/srv/git/emacs
Diffstat (limited to 'test/lisp')
| -rw-r--r-- | test/lisp/dired-x-tests.el | 53 | ||||
| -rw-r--r-- | test/lisp/emacs-lisp/cl-lib-tests.el | 26 | ||||
| -rw-r--r-- | test/lisp/emacs-lisp/lisp-mode-tests.el | 4 | ||||
| -rw-r--r-- | test/lisp/filenotify-tests.el | 65 | ||||
| -rw-r--r-- | test/lisp/net/tramp-tests.el | 18 | ||||
| -rw-r--r-- | test/lisp/progmodes/js-tests.el | 37 | ||||
| -rw-r--r-- | test/lisp/progmodes/python-tests.el | 19 | ||||
| -rw-r--r-- | test/lisp/url/url-auth-tests.el | 51 | ||||
| -rw-r--r-- | test/lisp/vc/ediff-ptch-tests.el | 69 |
9 files changed, 323 insertions, 19 deletions
diff --git a/test/lisp/dired-x-tests.el b/test/lisp/dired-x-tests.el new file mode 100644 index 00000000000..e8352a4ecaf --- /dev/null +++ b/test/lisp/dired-x-tests.el | |||
| @@ -0,0 +1,53 @@ | |||
| 1 | ;;; dired-x-tests.el --- Test suite for dired-x. -*- lexical-binding: t -*- | ||
| 2 | |||
| 3 | ;; Copyright (C) 2017 Free Software Foundation, Inc. | ||
| 4 | |||
| 5 | ;; This file is part of GNU Emacs. | ||
| 6 | |||
| 7 | ;; GNU Emacs is free software: you can redistribute it and/or modify | ||
| 8 | ;; it under the terms of the GNU General Public License as published by | ||
| 9 | ;; the Free Software Foundation, either version 3 of the License, or | ||
| 10 | ;; (at your option) any later version. | ||
| 11 | |||
| 12 | ;; GNU Emacs is distributed in the hope that it will be useful, | ||
| 13 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 14 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 15 | ;; GNU General Public License for more details. | ||
| 16 | |||
| 17 | ;; You should have received a copy of the GNU General Public License | ||
| 18 | ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. | ||
| 19 | |||
| 20 | ;;; Code: | ||
| 21 | (require 'ert) | ||
| 22 | (require 'dired-x) | ||
| 23 | |||
| 24 | |||
| 25 | (ert-deftest dired-test-bug25942 () | ||
| 26 | "Test for http://debbugs.gnu.org/25942 ." | ||
| 27 | (let* ((dirs (list "Public" "Music")) | ||
| 28 | (files (list ".bashrc" "bar.c" "foo.c" "c" ".c")) | ||
| 29 | (all-but-c | ||
| 30 | (sort | ||
| 31 | (append (copy-sequence dirs) | ||
| 32 | (delete "c" (copy-sequence files))) | ||
| 33 | #'string<)) | ||
| 34 | (dir (make-temp-file "Bug25942" 'dir)) | ||
| 35 | (extension "c")) | ||
| 36 | (unwind-protect | ||
| 37 | (progn | ||
| 38 | (dolist (d dirs) | ||
| 39 | (make-directory (expand-file-name d dir))) | ||
| 40 | (dolist (f files) | ||
| 41 | (write-region nil nil (expand-file-name f dir))) | ||
| 42 | (dired dir) | ||
| 43 | (dired-mark-extension extension) | ||
| 44 | (should (equal '("bar.c" "foo.c") | ||
| 45 | (sort (dired-get-marked-files 'local) #'string<))) | ||
| 46 | (dired-unmark-all-marks) | ||
| 47 | (dired-mark-suffix extension) | ||
| 48 | (should (equal all-but-c | ||
| 49 | (sort (dired-get-marked-files 'local) #'string<)))) | ||
| 50 | (delete-directory dir 'recursive)))) | ||
| 51 | |||
| 52 | (provide 'dired-x-tests) | ||
| 53 | ;; dired-x-tests.el ends here | ||
diff --git a/test/lisp/emacs-lisp/cl-lib-tests.el b/test/lisp/emacs-lisp/cl-lib-tests.el index 5edc3e72bf2..093cb3476c1 100644 --- a/test/lisp/emacs-lisp/cl-lib-tests.el +++ b/test/lisp/emacs-lisp/cl-lib-tests.el | |||
| @@ -493,4 +493,30 @@ | |||
| 493 | (should (cl-typep '* 'cl-lib-test-type)) | 493 | (should (cl-typep '* 'cl-lib-test-type)) |
| 494 | (should-not (cl-typep 1 'cl-lib-test-type))) | 494 | (should-not (cl-typep 1 'cl-lib-test-type))) |
| 495 | 495 | ||
| 496 | (ert-deftest cl-lib-symbol-macrolet () | ||
| 497 | ;; bug#26325 | ||
| 498 | :expected-result :failed | ||
| 499 | (should (equal (cl-flet ((f (x) (+ x 5))) | ||
| 500 | (let ((x 5)) | ||
| 501 | (f (+ x 6)))) | ||
| 502 | ;; Go through `eval', otherwise the macro-expansion | ||
| 503 | ;; error prevents running the whole test suite :-( | ||
| 504 | (eval '(cl-symbol-macrolet ((f (+ x 6))) | ||
| 505 | (cl-flet ((f (x) (+ x 5))) | ||
| 506 | (let ((x 5)) | ||
| 507 | (f f)))) | ||
| 508 | t)))) | ||
| 509 | |||
| 510 | (defmacro cl-lib-symbol-macrolet-4+5 () | ||
| 511 | ;; bug#26068 | ||
| 512 | (let* ((sname "x") | ||
| 513 | (s1 (make-symbol sname)) | ||
| 514 | (s2 (make-symbol sname))) | ||
| 515 | `(cl-symbol-macrolet ((,s1 4) | ||
| 516 | (,s2 5)) | ||
| 517 | (+ ,s1 ,s2)))) | ||
| 518 | |||
| 519 | (ert-deftest cl-lib-symbol-macrolet-2 () | ||
| 520 | (should (equal (cl-lib-symbol-macrolet-4+5) (+ 4 5)))) | ||
| 521 | |||
| 496 | ;;; cl-lib.el ends here | 522 | ;;; cl-lib.el ends here |
diff --git a/test/lisp/emacs-lisp/lisp-mode-tests.el b/test/lisp/emacs-lisp/lisp-mode-tests.el index 2801f23df63..8e3f2e185cf 100644 --- a/test/lisp/emacs-lisp/lisp-mode-tests.el +++ b/test/lisp/emacs-lisp/lisp-mode-tests.el | |||
| @@ -77,6 +77,10 @@ noindent\" 3 | |||
| 77 | (search-backward "d2") | 77 | (search-backward "d2") |
| 78 | (up-list -1) | 78 | (up-list -1) |
| 79 | (indent-sexp) | 79 | (indent-sexp) |
| 80 | (should (equal (buffer-string) correct)) | ||
| 81 | (backward-sexp) | ||
| 82 | (end-of-line) | ||
| 83 | (indent-sexp) | ||
| 80 | (should (equal (buffer-string) correct))))) | 84 | (should (equal (buffer-string) correct))))) |
| 81 | 85 | ||
| 82 | (ert-deftest indent-sexp-in-string () | 86 | (ert-deftest indent-sexp-in-string () |
diff --git a/test/lisp/filenotify-tests.el b/test/lisp/filenotify-tests.el index 72080322379..54e7ebfc0e5 100644 --- a/test/lisp/filenotify-tests.el +++ b/test/lisp/filenotify-tests.el | |||
| @@ -294,13 +294,20 @@ This returns only for the local case and gfilenotify; otherwise it is nil. | |||
| 294 | (file-notify-add-watch | 294 | (file-notify-add-watch |
| 295 | temporary-file-directory '(change attribute-change) #'ignore))) | 295 | temporary-file-directory '(change attribute-change) #'ignore))) |
| 296 | (file-notify-rm-watch file-notify--test-desc) | 296 | (file-notify-rm-watch file-notify--test-desc) |
| 297 | (write-region "any text" nil file-notify--test-tmpfile nil 'no-message) | 297 | |
| 298 | ;; File monitors like kqueue insist, that the watched file | ||
| 299 | ;; exists. Directory monitors are not bound to this | ||
| 300 | ;; restriction. | ||
| 301 | (when (string-equal (file-notify--test-library) "kqueue") | ||
| 302 | (write-region | ||
| 303 | "any text" nil file-notify--test-tmpfile nil 'no-message)) | ||
| 298 | (should | 304 | (should |
| 299 | (setq file-notify--test-desc | 305 | (setq file-notify--test-desc |
| 300 | (file-notify-add-watch | 306 | (file-notify-add-watch |
| 301 | file-notify--test-tmpfile '(change attribute-change) #'ignore))) | 307 | file-notify--test-tmpfile '(change attribute-change) #'ignore))) |
| 302 | (file-notify-rm-watch file-notify--test-desc) | 308 | (file-notify-rm-watch file-notify--test-desc) |
| 303 | (delete-file file-notify--test-tmpfile) | 309 | (when (string-equal (file-notify--test-library) "kqueue") |
| 310 | (delete-file file-notify--test-tmpfile)) | ||
| 304 | 311 | ||
| 305 | ;; Check error handling. | 312 | ;; Check error handling. |
| 306 | (should-error (file-notify-add-watch 1 2 3 4) | 313 | (should-error (file-notify-add-watch 1 2 3 4) |
| @@ -340,20 +347,19 @@ This returns only for the local case and gfilenotify; otherwise it is nil. | |||
| 340 | (expand-file-name | 347 | (expand-file-name |
| 341 | (make-temp-name "file-notify-test") temporary-file-directory)) | 348 | (make-temp-name "file-notify-test") temporary-file-directory)) |
| 342 | 349 | ||
| 343 | ;; This test is inspired by Bug#26127. | 350 | ;; This test is inspired by Bug#26126 and Bug#26127. |
| 344 | (ert-deftest file-notify-test02-rm-watch () | 351 | (ert-deftest file-notify-test02-rm-watch () |
| 345 | "Check `file-notify-rm-watch'." | 352 | "Check `file-notify-rm-watch'." |
| 346 | (skip-unless (file-notify--test-local-enabled)) | 353 | (skip-unless (file-notify--test-local-enabled)) |
| 347 | 354 | ||
| 348 | (unwind-protect | 355 | (unwind-protect |
| 356 | ;; Check, that `file-notify-rm-watch' works. | ||
| 349 | (progn | 357 | (progn |
| 350 | ;; Check, that `file-notify-rm-watch' works. | ||
| 351 | (should | 358 | (should |
| 352 | (setq file-notify--test-desc | 359 | (setq file-notify--test-desc |
| 353 | (file-notify-add-watch | 360 | (file-notify-add-watch |
| 354 | temporary-file-directory '(change) #'ignore))) | 361 | temporary-file-directory '(change) #'ignore))) |
| 355 | (file-notify-rm-watch file-notify--test-desc) | 362 | (file-notify-rm-watch file-notify--test-desc) |
| 356 | |||
| 357 | ;; Check, that any parameter is accepted. | 363 | ;; Check, that any parameter is accepted. |
| 358 | (condition-case err | 364 | (condition-case err |
| 359 | (progn | 365 | (progn |
| @@ -363,9 +369,19 @@ This returns only for the local case and gfilenotify; otherwise it is nil. | |||
| 363 | (file-notify-rm-watch 'foo)) | 369 | (file-notify-rm-watch 'foo)) |
| 364 | (error (ert-fail err))) | 370 | (error (ert-fail err))) |
| 365 | 371 | ||
| 366 | ;; Check, that no error is returned removing a watch descriptor twice. | 372 | ;; The environment shall be cleaned up. |
| 373 | (file-notify--test-cleanup-p)) | ||
| 374 | |||
| 375 | ;; Cleanup. | ||
| 376 | (file-notify--test-cleanup)) | ||
| 377 | |||
| 378 | (unwind-protect | ||
| 379 | ;; Check, that no error is returned removing a watch descriptor twice. | ||
| 380 | (progn | ||
| 367 | (setq file-notify--test-tmpfile (file-notify--test-make-temp-name) | 381 | (setq file-notify--test-tmpfile (file-notify--test-make-temp-name) |
| 368 | file-notify--test-tmpfile1 (file-notify--test-make-temp-name)) | 382 | file-notify--test-tmpfile1 (file-notify--test-make-temp-name)) |
| 383 | (write-region "any text" nil file-notify--test-tmpfile nil 'no-message) | ||
| 384 | (write-region "any text" nil file-notify--test-tmpfile1 nil 'no-message) | ||
| 369 | (should | 385 | (should |
| 370 | (setq file-notify--test-desc | 386 | (setq file-notify--test-desc |
| 371 | (file-notify-add-watch | 387 | (file-notify-add-watch |
| @@ -374,14 +390,51 @@ This returns only for the local case and gfilenotify; otherwise it is nil. | |||
| 374 | (setq file-notify--test-desc1 | 390 | (setq file-notify--test-desc1 |
| 375 | (file-notify-add-watch | 391 | (file-notify-add-watch |
| 376 | file-notify--test-tmpfile1 '(change) #'ignore))) | 392 | file-notify--test-tmpfile1 '(change) #'ignore))) |
| 393 | ;; Remove `file-notify--test-desc' twice. | ||
| 377 | (file-notify-rm-watch file-notify--test-desc) | 394 | (file-notify-rm-watch file-notify--test-desc) |
| 378 | (file-notify-rm-watch file-notify--test-desc) | 395 | (file-notify-rm-watch file-notify--test-desc) |
| 379 | (file-notify-rm-watch file-notify--test-desc1) | 396 | (file-notify-rm-watch file-notify--test-desc1) |
| 397 | (delete-file file-notify--test-tmpfile) | ||
| 398 | (delete-file file-notify--test-tmpfile1) | ||
| 380 | 399 | ||
| 381 | ;; The environment shall be cleaned up. | 400 | ;; The environment shall be cleaned up. |
| 382 | (file-notify--test-cleanup-p)) | 401 | (file-notify--test-cleanup-p)) |
| 383 | 402 | ||
| 384 | ;; Cleanup. | 403 | ;; Cleanup. |
| 404 | (file-notify--test-cleanup)) | ||
| 405 | |||
| 406 | (unwind-protect | ||
| 407 | ;; Check, that removing watch descriptors out of order do not harm. | ||
| 408 | (let (results) | ||
| 409 | (cl-flet ((first-callback (event) | ||
| 410 | (when (eq (nth 1 event) 'deleted) (push 1 results))) | ||
| 411 | (second-callback (event) | ||
| 412 | (when (eq (nth 1 event) 'deleted) (push 2 results)))) | ||
| 413 | (setq file-notify--test-tmpfile (file-notify--test-make-temp-name)) | ||
| 414 | (write-region | ||
| 415 | "any text" nil file-notify--test-tmpfile nil 'no-message) | ||
| 416 | (should | ||
| 417 | (setq file-notify--test-desc | ||
| 418 | (file-notify-add-watch | ||
| 419 | file-notify--test-tmpfile | ||
| 420 | '(change) #'first-callback))) | ||
| 421 | (should | ||
| 422 | (setq file-notify--test-desc1 | ||
| 423 | (file-notify-add-watch | ||
| 424 | file-notify--test-tmpfile | ||
| 425 | '(change) #'second-callback))) | ||
| 426 | ;; Remove first watch. | ||
| 427 | (file-notify-rm-watch file-notify--test-desc) | ||
| 428 | ;; Only the second callback shall run. | ||
| 429 | (delete-file file-notify--test-tmpfile) | ||
| 430 | (file-notify--wait-for-events | ||
| 431 | (file-notify--test-timeout) results) | ||
| 432 | (should (equal results (list 2))) | ||
| 433 | |||
| 434 | ;; The environment shall be cleaned up. | ||
| 435 | (file-notify--test-cleanup-p))) | ||
| 436 | |||
| 437 | ;; Cleanup. | ||
| 385 | (file-notify--test-cleanup))) | 438 | (file-notify--test-cleanup))) |
| 386 | 439 | ||
| 387 | (file-notify--deftest-remote file-notify-test02-rm-watch | 440 | (file-notify--deftest-remote file-notify-test02-rm-watch |
diff --git a/test/lisp/net/tramp-tests.el b/test/lisp/net/tramp-tests.el index 45b4ff2f5ab..2a4ef740a04 100644 --- a/test/lisp/net/tramp-tests.el +++ b/test/lisp/net/tramp-tests.el | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | ;;; tramp-tests.el --- Tests of remote file access | 1 | ;;; tramp-tests.el --- Tests of remote file access -*- lexical-binding:t -*- |
| 2 | 2 | ||
| 3 | ;; Copyright (C) 2013-2017 Free Software Foundation, Inc. | 3 | ;; Copyright (C) 2013-2017 Free Software Foundation, Inc. |
| 4 | 4 | ||
| @@ -37,6 +37,7 @@ | |||
| 37 | 37 | ||
| 38 | ;;; Code: | 38 | ;;; Code: |
| 39 | 39 | ||
| 40 | (require 'dired) | ||
| 40 | (require 'ert) | 41 | (require 'ert) |
| 41 | (require 'tramp) | 42 | (require 'tramp) |
| 42 | (require 'vc) | 43 | (require 'vc) |
| @@ -44,11 +45,11 @@ | |||
| 44 | (require 'vc-git) | 45 | (require 'vc-git) |
| 45 | (require 'vc-hg) | 46 | (require 'vc-hg) |
| 46 | 47 | ||
| 47 | (autoload 'dired-uncache "dired") | ||
| 48 | (declare-function tramp-find-executable "tramp-sh") | 48 | (declare-function tramp-find-executable "tramp-sh") |
| 49 | (declare-function tramp-get-remote-path "tramp-sh") | 49 | (declare-function tramp-get-remote-path "tramp-sh") |
| 50 | (declare-function tramp-get-remote-stat "tramp-sh") | 50 | (declare-function tramp-get-remote-stat "tramp-sh") |
| 51 | (declare-function tramp-get-remote-perl "tramp-sh") | 51 | (declare-function tramp-get-remote-perl "tramp-sh") |
| 52 | (defvar auto-save-file-name-transforms) | ||
| 52 | (defvar tramp-copy-size-limit) | 53 | (defvar tramp-copy-size-limit) |
| 53 | (defvar tramp-persistency-file-name) | 54 | (defvar tramp-persistency-file-name) |
| 54 | (defvar tramp-remote-process-environment) | 55 | (defvar tramp-remote-process-environment) |
| @@ -2083,17 +2084,20 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'." | |||
| 2083 | (skip-unless | 2084 | (skip-unless |
| 2084 | (and (fboundp 'make-nearby-temp-file) (fboundp 'temporary-file-directory))) | 2085 | (and (fboundp 'make-nearby-temp-file) (fboundp 'temporary-file-directory))) |
| 2085 | 2086 | ||
| 2087 | ;; `make-nearby-temp-file' and `temporary-file-directory' exists | ||
| 2088 | ;; since Emacs 26. We don't want to see compiler warnings for older | ||
| 2089 | ;; Emacsen." | ||
| 2086 | (let ((default-directory tramp-test-temporary-file-directory) | 2090 | (let ((default-directory tramp-test-temporary-file-directory) |
| 2087 | tmp-file) | 2091 | tmp-file) |
| 2088 | ;; The remote host shall know a temporary file directory. | 2092 | ;; The remote host shall know a temporary file directory. |
| 2089 | (should (stringp (temporary-file-directory))) | 2093 | (should (stringp (with-no-warnings (temporary-file-directory)))) |
| 2090 | (should | 2094 | (should |
| 2091 | (string-equal | 2095 | (string-equal |
| 2092 | (file-remote-p default-directory) | 2096 | (file-remote-p default-directory) |
| 2093 | (file-remote-p (temporary-file-directory)))) | 2097 | (file-remote-p (with-no-warnings (temporary-file-directory))))) |
| 2094 | 2098 | ||
| 2095 | ;; The temporary file shall be located on the remote host. | 2099 | ;; The temporary file shall be located on the remote host. |
| 2096 | (setq tmp-file (make-nearby-temp-file "tramp-test")) | 2100 | (setq tmp-file (with-no-warnings (make-nearby-temp-file "tramp-test"))) |
| 2097 | (should (file-exists-p tmp-file)) | 2101 | (should (file-exists-p tmp-file)) |
| 2098 | (should (file-regular-p tmp-file)) | 2102 | (should (file-regular-p tmp-file)) |
| 2099 | (should | 2103 | (should |
| @@ -2103,7 +2107,7 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'." | |||
| 2103 | (delete-file tmp-file) | 2107 | (delete-file tmp-file) |
| 2104 | (should-not (file-exists-p tmp-file)) | 2108 | (should-not (file-exists-p tmp-file)) |
| 2105 | 2109 | ||
| 2106 | (setq tmp-file (make-nearby-temp-file "tramp-test" 'dir)) | 2110 | (setq tmp-file (with-no-warnings (make-nearby-temp-file "tramp-test" 'dir))) |
| 2107 | (should (file-exists-p tmp-file)) | 2111 | (should (file-exists-p tmp-file)) |
| 2108 | (should (file-directory-p tmp-file)) | 2112 | (should (file-directory-p tmp-file)) |
| 2109 | (delete-directory tmp-file) | 2113 | (delete-directory tmp-file) |
| @@ -2582,7 +2586,7 @@ process sentinels. They shall not disturb each other." | |||
| 2582 | ;; Create temporary buffers. The number of buffers | 2586 | ;; Create temporary buffers. The number of buffers |
| 2583 | ;; corresponds to the number of processes; it could be | 2587 | ;; corresponds to the number of processes; it could be |
| 2584 | ;; increased in order to make pressure on Tramp. | 2588 | ;; increased in order to make pressure on Tramp. |
| 2585 | (dotimes (i 5) | 2589 | (dotimes (_i 5) |
| 2586 | (add-to-list 'buffers (generate-new-buffer "*temp*"))) | 2590 | (add-to-list 'buffers (generate-new-buffer "*temp*"))) |
| 2587 | 2591 | ||
| 2588 | ;; Open asynchronous processes. Set process sentinel. | 2592 | ;; Open asynchronous processes. Set process sentinel. |
diff --git a/test/lisp/progmodes/js-tests.el b/test/lisp/progmodes/js-tests.el index e030675e07c..8e1bac10cd1 100644 --- a/test/lisp/progmodes/js-tests.el +++ b/test/lisp/progmodes/js-tests.el | |||
| @@ -140,6 +140,43 @@ if (!/[ (:,='\"]/.test(value)) { | |||
| 140 | (font-lock-ensure) | 140 | (font-lock-ensure) |
| 141 | (should (eq (get-text-property (point) 'face) (caddr test)))))) | 141 | (should (eq (get-text-property (point) 'face) (caddr test)))))) |
| 142 | 142 | ||
| 143 | (ert-deftest js-mode-propertize-bug-1 () | ||
| 144 | (with-temp-buffer | ||
| 145 | (js-mode) | ||
| 146 | (save-excursion (insert "x")) | ||
| 147 | (insert "/") | ||
| 148 | ;; The bug was a hang. | ||
| 149 | (should t))) | ||
| 150 | |||
| 151 | (ert-deftest js-mode-propertize-bug-2 () | ||
| 152 | (with-temp-buffer | ||
| 153 | (js-mode) | ||
| 154 | (insert "function f() { | ||
| 155 | function g() | ||
| 156 | { | ||
| 157 | 1 / 2; | ||
| 158 | } | ||
| 159 | |||
| 160 | function h() { | ||
| 161 | ") | ||
| 162 | (save-excursion | ||
| 163 | (insert " | ||
| 164 | 00000000000000000000000000000000000000000000000000; | ||
| 165 | 00000000000000000000000000000000000000000000000000; | ||
| 166 | 00000000000000000000000000000000000000000000000000; | ||
| 167 | 00000000000000000000000000000000000000000000000000; | ||
| 168 | 00000000000000000000000000000000000000000000000000; | ||
| 169 | 00000000000000000000000000000000000000000000000000; | ||
| 170 | 00000000000000000000000000000000000000000000000000; | ||
| 171 | 00000000000000000000000000000000000000000000000000; | ||
| 172 | 00; | ||
| 173 | } | ||
| 174 | } | ||
| 175 | ")) | ||
| 176 | (insert "/") | ||
| 177 | ;; The bug was a hang. | ||
| 178 | (should t))) | ||
| 179 | |||
| 143 | (provide 'js-tests) | 180 | (provide 'js-tests) |
| 144 | 181 | ||
| 145 | ;;; js-tests.el ends here | 182 | ;;; js-tests.el ends here |
diff --git a/test/lisp/progmodes/python-tests.el b/test/lisp/progmodes/python-tests.el index 1e6b867d30b..2f4c2fb849d 100644 --- a/test/lisp/progmodes/python-tests.el +++ b/test/lisp/progmodes/python-tests.el | |||
| @@ -5314,6 +5314,25 @@ class SomeClass: | |||
| 5314 | (or enabled (hs-minor-mode -1))))) | 5314 | (or enabled (hs-minor-mode -1))))) |
| 5315 | 5315 | ||
| 5316 | 5316 | ||
| 5317 | (ert-deftest python-tests--python-nav-end-of-statement--infloop () | ||
| 5318 | "Checks that `python-nav-end-of-statement' doesn't infloop in a | ||
| 5319 | buffer with overlapping strings." | ||
| 5320 | (python-tests-with-temp-buffer "''' '\n''' ' '\n" | ||
| 5321 | (syntax-propertize (point-max)) | ||
| 5322 | ;; Create a situation where strings nominally overlap. This | ||
| 5323 | ;; shouldn't happen in practice, but apparently it can happen when | ||
| 5324 | ;; a package calls `syntax-ppss' in a narrowed buffer during JIT | ||
| 5325 | ;; lock. | ||
| 5326 | (put-text-property 4 5 'syntax-table (string-to-syntax "|")) | ||
| 5327 | (remove-text-properties 8 9 '(syntax-table nil)) | ||
| 5328 | (goto-char 4) | ||
| 5329 | (setq-local syntax-propertize-function nil) | ||
| 5330 | ;; The next form should not infloop. We have to disable | ||
| 5331 | ;; ‘debug-on-error’ so that ‘cl-assert’ doesn’t call the debugger. | ||
| 5332 | (should-error (let ((debug-on-error nil)) | ||
| 5333 | (python-nav-end-of-statement))) | ||
| 5334 | (should (eolp)))) | ||
| 5335 | |||
| 5317 | 5336 | ||
| 5318 | (provide 'python-tests) | 5337 | (provide 'python-tests) |
| 5319 | 5338 | ||
diff --git a/test/lisp/url/url-auth-tests.el b/test/lisp/url/url-auth-tests.el index 11e5a479720..30636db083c 100644 --- a/test/lisp/url/url-auth-tests.el +++ b/test/lisp/url/url-auth-tests.el | |||
| @@ -77,6 +77,49 @@ server's WWW-Authenticate header field.") | |||
| 77 | :expected-ha2 "b44272ea65ee4af7fb26c5dba58f6863" | 77 | :expected-ha2 "b44272ea65ee4af7fb26c5dba58f6863" |
| 78 | :expected-response "0d84884d967e04440efc77e9e2b5b561"))) | 78 | :expected-response "0d84884d967e04440efc77e9e2b5b561"))) |
| 79 | 79 | ||
| 80 | (ert-deftest url-auth-test-colonjoin () | ||
| 81 | "Check joining strings with `:'." | ||
| 82 | (should (string= (url-digest-auth-colonjoin) "")) | ||
| 83 | (should (string= (url-digest-auth-colonjoin nil) "")) | ||
| 84 | (should (string= (url-digest-auth-colonjoin nil nil nil) "::")) | ||
| 85 | (should (string= (url-digest-auth-colonjoin "") "")) | ||
| 86 | (should (string= (url-digest-auth-colonjoin "" "") ":")) | ||
| 87 | (should (string= (url-digest-auth-colonjoin "one") "one")) | ||
| 88 | (should (string= (url-digest-auth-colonjoin "one" "two" "three") "one:two:three"))) | ||
| 89 | |||
| 90 | (ert-deftest url-auth-test-digest-ha1 () | ||
| 91 | "Check HA1 computation." | ||
| 92 | (dolist (row url-auth-test-challenges) | ||
| 93 | (should (string= (url-digest-auth-make-ha1 (plist-get row :username) | ||
| 94 | (plist-get row :realm) | ||
| 95 | (plist-get row :password)) | ||
| 96 | (plist-get row :expected-ha1) | ||
| 97 | )))) | ||
| 98 | |||
| 99 | (ert-deftest url-auth-test-digest-ha2 () | ||
| 100 | "Check HA2 computation." | ||
| 101 | (dolist (row url-auth-test-challenges) | ||
| 102 | (should (string= (url-digest-auth-make-ha2 (plist-get row :method) | ||
| 103 | (plist-get row :uri)) | ||
| 104 | (plist-get row :expected-ha2))))) | ||
| 105 | |||
| 106 | (ert-deftest url-auth-test-digest-request-digest () | ||
| 107 | "Check digest response value." | ||
| 108 | (dolist (row url-auth-test-challenges) | ||
| 109 | (should (string= (plist-get row :expected-response) | ||
| 110 | (if (plist-member row :qop) | ||
| 111 | (url-digest-auth-make-request-digest-qop | ||
| 112 | (plist-get row :qop) | ||
| 113 | (plist-get row :expected-ha1) | ||
| 114 | (plist-get row :expected-ha2) | ||
| 115 | (plist-get row :nonce) | ||
| 116 | (plist-get row :nc) | ||
| 117 | (plist-get row :cnonce)) | ||
| 118 | (url-digest-auth-make-request-digest | ||
| 119 | (plist-get row :expected-ha1) | ||
| 120 | (plist-get row :expected-ha2) | ||
| 121 | (plist-get row :nonce))))))) | ||
| 122 | |||
| 80 | (ert-deftest url-auth-test-digest-create-key () | 123 | (ert-deftest url-auth-test-digest-create-key () |
| 81 | "Check user credentials in their hashed form." | 124 | "Check user credentials in their hashed form." |
| 82 | (dolist (challenge url-auth-test-challenges) | 125 | (dolist (challenge url-auth-test-challenges) |
| @@ -223,14 +266,12 @@ test and cannot be passed by arguments to `url-digest-auth'." | |||
| 223 | (progn | 266 | (progn |
| 224 | ;; We don't know these, just check that they exists. | 267 | ;; We don't know these, just check that they exists. |
| 225 | (should (string-match-p ".*response=\".*?\".*" auth)) | 268 | (should (string-match-p ".*response=\".*?\".*" auth)) |
| 226 | ;; url-digest-auth doesn't return these AFAICS. | 269 | (should (string-match-p ".*nc=\".*?\".*" auth)) |
| 227 | ;;; (should (string-match-p ".*nc=\".*?\".*" auth)) | 270 | (should (string-match-p ".*cnonce=\".*?\".*" auth))) |
| 228 | ;;; (should (string-match-p ".*cnonce=\".*?\".*" auth)) | ||
| 229 | ) | ||
| 230 | (should (string-match ".*response=\"\\(.*?\\)\".*" auth)) | 271 | (should (string-match ".*response=\"\\(.*?\\)\".*" auth)) |
| 231 | (should (string= (match-string 1 auth) | 272 | (should (string= (match-string 1 auth) |
| 232 | (plist-get challenge :expected-response)))) | 273 | (plist-get challenge :expected-response)))) |
| 233 | ))) | 274 | ))) |
| 234 | 275 | ||
| 235 | (ert-deftest url-auth-test-digest-auth-opaque () | 276 | (ert-deftest url-auth-test-digest-auth-opaque () |
| 236 | "Check that `opaque' value is added to result when presented by | 277 | "Check that `opaque' value is added to result when presented by |
diff --git a/test/lisp/vc/ediff-ptch-tests.el b/test/lisp/vc/ediff-ptch-tests.el index 912c6b1e818..387786ced06 100644 --- a/test/lisp/vc/ediff-ptch-tests.el +++ b/test/lisp/vc/ediff-ptch-tests.el | |||
| @@ -22,7 +22,7 @@ | |||
| 22 | (require 'ert) | 22 | (require 'ert) |
| 23 | (require 'ediff-ptch) | 23 | (require 'ediff-ptch) |
| 24 | 24 | ||
| 25 | (ert-deftest ibuffer-test-bug25010 () | 25 | (ert-deftest ediff-ptch-test-bug25010 () |
| 26 | "Test for http://debbugs.gnu.org/25010 ." | 26 | "Test for http://debbugs.gnu.org/25010 ." |
| 27 | (with-temp-buffer | 27 | (with-temp-buffer |
| 28 | (insert "diff --git a/lisp/vc/ediff-ptch.el b/lisp/vc/ediff-ptch.el | 28 | (insert "diff --git a/lisp/vc/ediff-ptch.el b/lisp/vc/ediff-ptch.el |
| @@ -38,5 +38,72 @@ index 6a07f80..6e8e947 100644 | |||
| 38 | (match-string 1)))) | 38 | (match-string 1)))) |
| 39 | (should-not (string-suffix-p "@@" filename))))) | 39 | (should-not (string-suffix-p "@@" filename))))) |
| 40 | 40 | ||
| 41 | |||
| 42 | (ert-deftest ediff-ptch-test-bug26084 () | ||
| 43 | "Test for http://debbugs.gnu.org/26084 ." | ||
| 44 | (skip-unless (executable-find "git")) | ||
| 45 | (skip-unless (executable-find ediff-patch-program)) | ||
| 46 | (let* ((tmpdir (make-temp-file "ediff-ptch-test" t)) | ||
| 47 | (default-directory (file-name-as-directory tmpdir)) | ||
| 48 | (patch (make-temp-file "ediff-ptch-test")) | ||
| 49 | (qux (expand-file-name "qux.txt" tmpdir)) | ||
| 50 | (bar (expand-file-name "bar.txt" tmpdir)) | ||
| 51 | (git-program (executable-find "git"))) | ||
| 52 | ;; Create repository. | ||
| 53 | (with-temp-buffer | ||
| 54 | (insert "qux here\n") | ||
| 55 | (write-region nil nil qux nil 'silent) | ||
| 56 | (erase-buffer) | ||
| 57 | (insert "bar here\n") | ||
| 58 | (write-region nil nil bar nil 'silent)) | ||
| 59 | (call-process git-program nil nil nil "init") | ||
| 60 | (call-process git-program nil nil nil "add" ".") | ||
| 61 | (call-process git-program nil nil nil "commit" "-m" "Test repository.") | ||
| 62 | ;; Update repo., save the diff and reset to initial state. | ||
| 63 | (with-temp-buffer | ||
| 64 | (insert "foo here\n") | ||
| 65 | (write-region nil nil qux nil 'silent) | ||
| 66 | (write-region nil nil bar nil 'silent)) | ||
| 67 | (call-process git-program nil `(:file ,patch) nil "diff") | ||
| 68 | (call-process git-program nil nil nil "reset" "--hard" "HEAD") | ||
| 69 | (find-file patch) | ||
| 70 | (unwind-protect | ||
| 71 | (let* ((info | ||
| 72 | (progn (ediff-map-patch-buffer (current-buffer)) ediff-patch-map)) | ||
| 73 | (patch1 | ||
| 74 | (buffer-substring-no-properties | ||
| 75 | (car (nth 3 (car info))) | ||
| 76 | (car (nth 4 (car info))))) | ||
| 77 | (patch2 | ||
| 78 | (buffer-substring-no-properties | ||
| 79 | (car (nth 3 (cadr info))) | ||
| 80 | (car (nth 4 (cadr info)))))) | ||
| 81 | ;; Apply both patches. | ||
| 82 | (dolist (x (list (cons patch1 bar) (cons patch2 qux))) | ||
| 83 | (with-temp-buffer | ||
| 84 | (insert (car x)) | ||
| 85 | (call-process-region (point-min) | ||
| 86 | (point-max) | ||
| 87 | ediff-patch-program | ||
| 88 | nil nil nil | ||
| 89 | "-b" (cdr x)))) | ||
| 90 | ;; Check backup files were saved correctly. | ||
| 91 | (dolist (x (list qux bar)) | ||
| 92 | (let ((backup | ||
| 93 | (car | ||
| 94 | (directory-files | ||
| 95 | tmpdir 'full | ||
| 96 | (concat (file-name-nondirectory x) "."))))) | ||
| 97 | (should-not | ||
| 98 | (string= (with-temp-buffer | ||
| 99 | (insert-file-contents x) | ||
| 100 | (buffer-string)) | ||
| 101 | (with-temp-buffer | ||
| 102 | (insert-file-contents backup) | ||
| 103 | (buffer-string)))))) | ||
| 104 | (delete-directory tmpdir 'recursive) | ||
| 105 | (delete-file patch))))) | ||
| 106 | |||
| 107 | |||
| 41 | (provide 'ediff-ptch-tests) | 108 | (provide 'ediff-ptch-tests) |
| 42 | ;;; ediff-ptch-tests.el ends here | 109 | ;;; ediff-ptch-tests.el ends here |