1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-15 10:30:25 -08:00

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
This commit is contained in:
Glenn Morris 2017-11-29 17:12:56 -08:00
commit f069ea4f84
20 changed files with 107 additions and 80 deletions

View file

@ -1683,6 +1683,10 @@ This checks also `file-name-as-directory', `file-name-directory',
(string-equal
(directory-file-name "/method:host:/path/to/file/")
"/method:host:/path/to/file"))
(should
(string-equal
(directory-file-name "/method:host:/path/to/file//")
"/method:host:/path/to/file"))
(should
(string-equal
(file-name-as-directory "/method:host:/path/to/file")
@ -2341,7 +2345,10 @@ This tests also `file-directory-p' and `file-accessible-directory-p'."
;; There might be a summary line.
"\\(total.+[[:digit:]]+\n\\)?"
;; We don't know in which order ".", ".." and "foo" appear.
"\\(.+ \\(\\.?\\.\\|foo\\)\n\\)\\{3\\}")))))
(format
"\\(.+ %s\\( ->.+\\)?\n\\)\\{%d\\}"
(regexp-opt (directory-files tmp-name1))
(length (directory-files tmp-name1))))))))
;; Cleanup.
(ignore-errors (delete-directory tmp-name1 'recursive))))))
@ -4445,8 +4452,8 @@ Use the `ls' command."
;; Since Emacs 27.1.
(skip-unless (fboundp 'file-system-info))
;; `file-system-info' exists since Emacs 27. We don't
;; want to see compiler warnings for older Emacsen.
;; `file-system-info' exists since Emacs 27. We don't want to see
;; compiler warnings for older Emacsen.
(let ((fsi (with-no-warnings
(file-system-info tramp-test-temporary-file-directory))))
(skip-unless fsi)
@ -4622,22 +4629,50 @@ process sentinels. They shall not disturb each other."
(skip-unless (tramp--test-enabled))
(skip-unless (not (tramp--test-mock-p)))
(let ((default-directory (expand-file-name temporary-file-directory)))
(let ((code
(format
"(message \"Tramp loaded: %%s\" (consp (file-attributes \"%s\")))"
tramp-test-temporary-file-directory)))
(let ((default-directory (expand-file-name temporary-file-directory))
(code
(format
"(message \"Tramp loaded: %%s\" (consp (file-attributes %S)))"
tramp-test-temporary-file-directory)))
(should
(string-match
"Tramp loaded: t[\n\r]+"
(shell-command-to-string
(format
"%s -batch -Q -L %s --eval %s"
(expand-file-name invocation-name invocation-directory)
(mapconcat 'shell-quote-argument load-path " -L ")
(shell-quote-argument code)))))))
(ert-deftest tramp-test42-delay-load ()
"Check that Tramp is loaded lazily, only when needed."
;; Tramp is neither loaded at Emacs startup, nor when completing a
;; non-Tramp file name like "/foo". Completing a Tramp-alike file
;; name like "/foo:" autoloads Tramp, when `tramp-mode' is t.
(let ((default-directory (expand-file-name temporary-file-directory))
(code
"(progn \
(setq tramp-mode %s) \
(message \"Tramp loaded: %%s\" (featurep 'tramp)) \
(file-name-all-completions \"/foo\" \"/\") \
(message \"Tramp loaded: %%s\" (featurep 'tramp)) \
(file-name-all-completions \"/foo:\" \"/\") \
(message \"Tramp loaded: %%s\" (featurep 'tramp)))"))
;; Tramp doesn't load when `tramp-mode' is nil since Emacs 26.1.
(dolist (tm (if (tramp--test-emacs26-p) '(t nil) '(nil)))
(should
(string-match
"Tramp loaded: t[\n\r]+"
(format
"Tramp loaded: nil[\n\r]+Tramp loaded: nil[\n\r]+Tramp loaded: %s[\n\r]+"
tm)
(shell-command-to-string
(format
"%s -batch -Q -L %s --eval %s"
(expand-file-name invocation-name invocation-directory)
(mapconcat 'shell-quote-argument load-path " -L ")
(shell-quote-argument code))))))))
(shell-quote-argument (format code tm)))))))))
(ert-deftest tramp-test43-recursive-load ()
(ert-deftest tramp-test42-recursive-load ()
"Check that Tramp does not fail due to recursive load."
(skip-unless (tramp--test-enabled))
@ -4660,7 +4695,7 @@ process sentinels. They shall not disturb each other."
(mapconcat 'shell-quote-argument load-path " -L ")
(shell-quote-argument code))))))))
(ert-deftest tramp-test44-remote-load-path ()
(ert-deftest tramp-test42-remote-load-path ()
"Check that Tramp autoloads its packages with remote `load-path'."
;; `tramp-cleanup-all-connections' is autoloaded from tramp-cmds.el.
;; It shall still work, when a remote file name is in the
@ -4683,34 +4718,7 @@ process sentinels. They shall not disturb each other."
(mapconcat 'shell-quote-argument load-path " -L ")
(shell-quote-argument code)))))))
(ert-deftest tramp-test45-delay-load ()
"Check that Tramp is loaded lazily, only when needed."
;; Tramp is neither loaded at Emacs startup, nor when completing a
;; non-Tramp file name like "/foo". Completing a Tramp-alike file
;; name like "/foo:" autoloads Tramp, when `tramp-mode' is t.
(let ((code
"(progn \
(setq tramp-mode %s) \
(message \"Tramp loaded: %%s\" (featurep 'tramp)) \
(file-name-all-completions \"/foo\" \"/\") \
(message \"Tramp loaded: %%s\" (featurep 'tramp)) \
(file-name-all-completions \"/foo:\" \"/\") \
(message \"Tramp loaded: %%s\" (featurep 'tramp)))"))
;; Tramp doesn't load when `tramp-mode' is nil since Emacs 26.1.
(dolist (tm (if (tramp--test-emacs26-p) '(t nil) '(nil)))
(should
(string-match
(format
"Tramp loaded: nil[\n\r]+Tramp loaded: nil[\n\r]+Tramp loaded: %s[\n\r]+"
tm)
(shell-command-to-string
(format
"%s -batch -Q -L %s --eval %s"
(expand-file-name invocation-name invocation-directory)
(mapconcat 'shell-quote-argument load-path " -L ")
(shell-quote-argument (format code tm)))))))))
(ert-deftest tramp-test46-unload ()
(ert-deftest tramp-test43-unload ()
"Check that Tramp and its subpackages unload completely.
Since it unloads Tramp, it shall be the last test to run."
:tags '(:expensive-test)
@ -4756,6 +4764,12 @@ Since it unloads Tramp, it shall be the last test to run."
(ignore-errors (all-completions "tramp" (symbol-value x)))
(ert-fail (format "Hook `%s' still contains Tramp function" x)))))))
(defun tramp-test-all (&optional interactive)
"Run all tests for \\[tramp]."
(interactive "p")
(funcall
(if interactive 'ert-run-tests-interactively 'ert-run-tests-batch) "^tramp"))
;; TODO:
;; * dired-compress-file
@ -4769,11 +4783,5 @@ Since it unloads Tramp, it shall be the last test to run."
;; * Fix `tramp-test30-interrupt-process', timeout doesn't work reliably.
;; * Fix Bug#16928 in `tramp-test41-asynchronous-requests'.
(defun tramp-test-all (&optional interactive)
"Run all tests for \\[tramp]."
(interactive "p")
(funcall
(if interactive 'ert-run-tests-interactively 'ert-run-tests-batch) "^tramp"))
(provide 'tramp-tests)
;;; tramp-tests.el ends here