diff options
| author | Glenn Morris | 2017-11-29 17:12:56 -0800 |
|---|---|---|
| committer | Glenn Morris | 2017-11-29 17:12:56 -0800 |
| commit | f069ea4f84a94bfbbd444073729f81fdd27c9445 (patch) | |
| tree | 6adf14a7d71264bb20c87a426df6e18e0edba9a3 /test | |
| parent | 03e1012be4028e653bd88c93846b17172b5c0faa (diff) | |
| parent | 408862f02a874dcd9cfc2599adb35dec522b3ef4 (diff) | |
| download | emacs-f069ea4f84a94bfbbd444073729f81fdd27c9445.tar.gz emacs-f069ea4f84a94bfbbd444073729f81fdd27c9445.zip | |
Merge from origin/emacs-26
408862f02a (origin/emacs-26) ; * lisp/emacs-lisp/bytecomp.el: Tweak m...
9964db4c34 Restore obsolete method of changing byte-compile-dest-file
3dd25aeecb Some minor Tramp corrections
d670a15f25 * doc/misc/url.texi (http/https): Fix typo
99d07e8d5e Remove some bogus definition-prefixes from loaddefs
6067f0c702 Shell-quote wildcards when invoking 'vc-git-grep'
0540df10e6 Update documentation of '.dir-locals-2.el'
f2441ab320 ; Fix some tiny doc and comment typos
22ff46e6d8 ; Fix some comment typos
# Conflicts:
# etc/NEWS
Diffstat (limited to 'test')
| -rw-r--r-- | test/lisp/net/tramp-tests.el | 100 |
1 files changed, 54 insertions, 46 deletions
diff --git a/test/lisp/net/tramp-tests.el b/test/lisp/net/tramp-tests.el index 8310003d9b1..044ab9329ff 100644 --- a/test/lisp/net/tramp-tests.el +++ b/test/lisp/net/tramp-tests.el | |||
| @@ -1685,6 +1685,10 @@ This checks also `file-name-as-directory', `file-name-directory', | |||
| 1685 | "/method:host:/path/to/file")) | 1685 | "/method:host:/path/to/file")) |
| 1686 | (should | 1686 | (should |
| 1687 | (string-equal | 1687 | (string-equal |
| 1688 | (directory-file-name "/method:host:/path/to/file//") | ||
| 1689 | "/method:host:/path/to/file")) | ||
| 1690 | (should | ||
| 1691 | (string-equal | ||
| 1688 | (file-name-as-directory "/method:host:/path/to/file") | 1692 | (file-name-as-directory "/method:host:/path/to/file") |
| 1689 | "/method:host:/path/to/file/")) | 1693 | "/method:host:/path/to/file/")) |
| 1690 | (should | 1694 | (should |
| @@ -2341,7 +2345,10 @@ This tests also `file-directory-p' and `file-accessible-directory-p'." | |||
| 2341 | ;; There might be a summary line. | 2345 | ;; There might be a summary line. |
| 2342 | "\\(total.+[[:digit:]]+\n\\)?" | 2346 | "\\(total.+[[:digit:]]+\n\\)?" |
| 2343 | ;; We don't know in which order ".", ".." and "foo" appear. | 2347 | ;; We don't know in which order ".", ".." and "foo" appear. |
| 2344 | "\\(.+ \\(\\.?\\.\\|foo\\)\n\\)\\{3\\}"))))) | 2348 | (format |
| 2349 | "\\(.+ %s\\( ->.+\\)?\n\\)\\{%d\\}" | ||
| 2350 | (regexp-opt (directory-files tmp-name1)) | ||
| 2351 | (length (directory-files tmp-name1)))))))) | ||
| 2345 | 2352 | ||
| 2346 | ;; Cleanup. | 2353 | ;; Cleanup. |
| 2347 | (ignore-errors (delete-directory tmp-name1 'recursive)))))) | 2354 | (ignore-errors (delete-directory tmp-name1 'recursive)))))) |
| @@ -4445,8 +4452,8 @@ Use the `ls' command." | |||
| 4445 | ;; Since Emacs 27.1. | 4452 | ;; Since Emacs 27.1. |
| 4446 | (skip-unless (fboundp 'file-system-info)) | 4453 | (skip-unless (fboundp 'file-system-info)) |
| 4447 | 4454 | ||
| 4448 | ;; `file-system-info' exists since Emacs 27. We don't | 4455 | ;; `file-system-info' exists since Emacs 27. We don't want to see |
| 4449 | ;; want to see compiler warnings for older Emacsen. | 4456 | ;; compiler warnings for older Emacsen. |
| 4450 | (let ((fsi (with-no-warnings | 4457 | (let ((fsi (with-no-warnings |
| 4451 | (file-system-info tramp-test-temporary-file-directory)))) | 4458 | (file-system-info tramp-test-temporary-file-directory)))) |
| 4452 | (skip-unless fsi) | 4459 | (skip-unless fsi) |
| @@ -4622,22 +4629,50 @@ process sentinels. They shall not disturb each other." | |||
| 4622 | (skip-unless (tramp--test-enabled)) | 4629 | (skip-unless (tramp--test-enabled)) |
| 4623 | (skip-unless (not (tramp--test-mock-p))) | 4630 | (skip-unless (not (tramp--test-mock-p))) |
| 4624 | 4631 | ||
| 4625 | (let ((default-directory (expand-file-name temporary-file-directory))) | 4632 | (let ((default-directory (expand-file-name temporary-file-directory)) |
| 4626 | (let ((code | 4633 | (code |
| 4627 | (format | 4634 | (format |
| 4628 | "(message \"Tramp loaded: %%s\" (consp (file-attributes \"%s\")))" | 4635 | "(message \"Tramp loaded: %%s\" (consp (file-attributes %S)))" |
| 4629 | tramp-test-temporary-file-directory))) | 4636 | tramp-test-temporary-file-directory))) |
| 4637 | (should | ||
| 4638 | (string-match | ||
| 4639 | "Tramp loaded: t[\n\r]+" | ||
| 4640 | (shell-command-to-string | ||
| 4641 | (format | ||
| 4642 | "%s -batch -Q -L %s --eval %s" | ||
| 4643 | (expand-file-name invocation-name invocation-directory) | ||
| 4644 | (mapconcat 'shell-quote-argument load-path " -L ") | ||
| 4645 | (shell-quote-argument code))))))) | ||
| 4646 | |||
| 4647 | (ert-deftest tramp-test42-delay-load () | ||
| 4648 | "Check that Tramp is loaded lazily, only when needed." | ||
| 4649 | ;; Tramp is neither loaded at Emacs startup, nor when completing a | ||
| 4650 | ;; non-Tramp file name like "/foo". Completing a Tramp-alike file | ||
| 4651 | ;; name like "/foo:" autoloads Tramp, when `tramp-mode' is t. | ||
| 4652 | (let ((default-directory (expand-file-name temporary-file-directory)) | ||
| 4653 | (code | ||
| 4654 | "(progn \ | ||
| 4655 | (setq tramp-mode %s) \ | ||
| 4656 | (message \"Tramp loaded: %%s\" (featurep 'tramp)) \ | ||
| 4657 | (file-name-all-completions \"/foo\" \"/\") \ | ||
| 4658 | (message \"Tramp loaded: %%s\" (featurep 'tramp)) \ | ||
| 4659 | (file-name-all-completions \"/foo:\" \"/\") \ | ||
| 4660 | (message \"Tramp loaded: %%s\" (featurep 'tramp)))")) | ||
| 4661 | ;; Tramp doesn't load when `tramp-mode' is nil since Emacs 26.1. | ||
| 4662 | (dolist (tm (if (tramp--test-emacs26-p) '(t nil) '(nil))) | ||
| 4630 | (should | 4663 | (should |
| 4631 | (string-match | 4664 | (string-match |
| 4632 | "Tramp loaded: t[\n\r]+" | 4665 | (format |
| 4666 | "Tramp loaded: nil[\n\r]+Tramp loaded: nil[\n\r]+Tramp loaded: %s[\n\r]+" | ||
| 4667 | tm) | ||
| 4633 | (shell-command-to-string | 4668 | (shell-command-to-string |
| 4634 | (format | 4669 | (format |
| 4635 | "%s -batch -Q -L %s --eval %s" | 4670 | "%s -batch -Q -L %s --eval %s" |
| 4636 | (expand-file-name invocation-name invocation-directory) | 4671 | (expand-file-name invocation-name invocation-directory) |
| 4637 | (mapconcat 'shell-quote-argument load-path " -L ") | 4672 | (mapconcat 'shell-quote-argument load-path " -L ") |
| 4638 | (shell-quote-argument code)))))))) | 4673 | (shell-quote-argument (format code tm))))))))) |
| 4639 | 4674 | ||
| 4640 | (ert-deftest tramp-test43-recursive-load () | 4675 | (ert-deftest tramp-test42-recursive-load () |
| 4641 | "Check that Tramp does not fail due to recursive load." | 4676 | "Check that Tramp does not fail due to recursive load." |
| 4642 | (skip-unless (tramp--test-enabled)) | 4677 | (skip-unless (tramp--test-enabled)) |
| 4643 | 4678 | ||
| @@ -4660,7 +4695,7 @@ process sentinels. They shall not disturb each other." | |||
| 4660 | (mapconcat 'shell-quote-argument load-path " -L ") | 4695 | (mapconcat 'shell-quote-argument load-path " -L ") |
| 4661 | (shell-quote-argument code)))))))) | 4696 | (shell-quote-argument code)))))))) |
| 4662 | 4697 | ||
| 4663 | (ert-deftest tramp-test44-remote-load-path () | 4698 | (ert-deftest tramp-test42-remote-load-path () |
| 4664 | "Check that Tramp autoloads its packages with remote `load-path'." | 4699 | "Check that Tramp autoloads its packages with remote `load-path'." |
| 4665 | ;; `tramp-cleanup-all-connections' is autoloaded from tramp-cmds.el. | 4700 | ;; `tramp-cleanup-all-connections' is autoloaded from tramp-cmds.el. |
| 4666 | ;; It shall still work, when a remote file name is in the | 4701 | ;; It shall still work, when a remote file name is in the |
| @@ -4683,34 +4718,7 @@ process sentinels. They shall not disturb each other." | |||
| 4683 | (mapconcat 'shell-quote-argument load-path " -L ") | 4718 | (mapconcat 'shell-quote-argument load-path " -L ") |
| 4684 | (shell-quote-argument code))))))) | 4719 | (shell-quote-argument code))))))) |
| 4685 | 4720 | ||
| 4686 | (ert-deftest tramp-test45-delay-load () | 4721 | (ert-deftest tramp-test43-unload () |
| 4687 | "Check that Tramp is loaded lazily, only when needed." | ||
| 4688 | ;; Tramp is neither loaded at Emacs startup, nor when completing a | ||
| 4689 | ;; non-Tramp file name like "/foo". Completing a Tramp-alike file | ||
| 4690 | ;; name like "/foo:" autoloads Tramp, when `tramp-mode' is t. | ||
| 4691 | (let ((code | ||
| 4692 | "(progn \ | ||
| 4693 | (setq tramp-mode %s) \ | ||
| 4694 | (message \"Tramp loaded: %%s\" (featurep 'tramp)) \ | ||
| 4695 | (file-name-all-completions \"/foo\" \"/\") \ | ||
| 4696 | (message \"Tramp loaded: %%s\" (featurep 'tramp)) \ | ||
| 4697 | (file-name-all-completions \"/foo:\" \"/\") \ | ||
| 4698 | (message \"Tramp loaded: %%s\" (featurep 'tramp)))")) | ||
| 4699 | ;; Tramp doesn't load when `tramp-mode' is nil since Emacs 26.1. | ||
| 4700 | (dolist (tm (if (tramp--test-emacs26-p) '(t nil) '(nil))) | ||
| 4701 | (should | ||
| 4702 | (string-match | ||
| 4703 | (format | ||
| 4704 | "Tramp loaded: nil[\n\r]+Tramp loaded: nil[\n\r]+Tramp loaded: %s[\n\r]+" | ||
| 4705 | tm) | ||
| 4706 | (shell-command-to-string | ||
| 4707 | (format | ||
| 4708 | "%s -batch -Q -L %s --eval %s" | ||
| 4709 | (expand-file-name invocation-name invocation-directory) | ||
| 4710 | (mapconcat 'shell-quote-argument load-path " -L ") | ||
| 4711 | (shell-quote-argument (format code tm))))))))) | ||
| 4712 | |||
| 4713 | (ert-deftest tramp-test46-unload () | ||
| 4714 | "Check that Tramp and its subpackages unload completely. | 4722 | "Check that Tramp and its subpackages unload completely. |
| 4715 | Since it unloads Tramp, it shall be the last test to run." | 4723 | Since it unloads Tramp, it shall be the last test to run." |
| 4716 | :tags '(:expensive-test) | 4724 | :tags '(:expensive-test) |
| @@ -4756,6 +4764,12 @@ Since it unloads Tramp, it shall be the last test to run." | |||
| 4756 | (ignore-errors (all-completions "tramp" (symbol-value x))) | 4764 | (ignore-errors (all-completions "tramp" (symbol-value x))) |
| 4757 | (ert-fail (format "Hook `%s' still contains Tramp function" x))))))) | 4765 | (ert-fail (format "Hook `%s' still contains Tramp function" x))))))) |
| 4758 | 4766 | ||
| 4767 | (defun tramp-test-all (&optional interactive) | ||
| 4768 | "Run all tests for \\[tramp]." | ||
| 4769 | (interactive "p") | ||
| 4770 | (funcall | ||
| 4771 | (if interactive 'ert-run-tests-interactively 'ert-run-tests-batch) "^tramp")) | ||
| 4772 | |||
| 4759 | ;; TODO: | 4773 | ;; TODO: |
| 4760 | 4774 | ||
| 4761 | ;; * dired-compress-file | 4775 | ;; * dired-compress-file |
| @@ -4769,11 +4783,5 @@ Since it unloads Tramp, it shall be the last test to run." | |||
| 4769 | ;; * Fix `tramp-test30-interrupt-process', timeout doesn't work reliably. | 4783 | ;; * Fix `tramp-test30-interrupt-process', timeout doesn't work reliably. |
| 4770 | ;; * Fix Bug#16928 in `tramp-test41-asynchronous-requests'. | 4784 | ;; * Fix Bug#16928 in `tramp-test41-asynchronous-requests'. |
| 4771 | 4785 | ||
| 4772 | (defun tramp-test-all (&optional interactive) | ||
| 4773 | "Run all tests for \\[tramp]." | ||
| 4774 | (interactive "p") | ||
| 4775 | (funcall | ||
| 4776 | (if interactive 'ert-run-tests-interactively 'ert-run-tests-batch) "^tramp")) | ||
| 4777 | |||
| 4778 | (provide 'tramp-tests) | 4786 | (provide 'tramp-tests) |
| 4779 | ;;; tramp-tests.el ends here | 4787 | ;;; tramp-tests.el ends here |