diff options
| author | Michael Albinus | 2018-02-03 13:22:56 +0100 |
|---|---|---|
| committer | Michael Albinus | 2018-02-03 13:22:56 +0100 |
| commit | 84c9dba4cee052b68b194c3a2e5c297a94d8c8af (patch) | |
| tree | d9b8f9c74fdeeda789f31c1785ab6d5dacab67e0 /test | |
| parent | 0e0ad865d49dbcfcebaae9204c52e8632e1e2ddf (diff) | |
| download | emacs-84c9dba4cee052b68b194c3a2e5c297a94d8c8af.tar.gz emacs-84c9dba4cee052b68b194c3a2e5c297a94d8c8af.zip | |
Autoload tramp-archive
* doc/misc/tramp.texi (Archive file names): Do not require to
load Tramp explicitly, this is autoloaded now also for file archives.
* lisp/net/tramp-archive.el (tramp-archive-suffixes)
(tramp-archive-compression-suffixes): Autoload them.
(tramp-archive-autoload-file-name-regexp): New defmacro.
(tramp-archive-file-name-regexp): Use it.
(tramp-register-archive-file-name-handler): New defun. Call
it in `after-init-hook'.
* test/lisp/net/tramp-archive-tests.el
(tramp-archive-test40-file-system-info): Rename from
`tramp-archive-test40-archive-file-system-info.
(tramp-archive-test42-auto-load)
(tramp-archive-test42-delay-load): New tests.
Diffstat (limited to 'test')
| -rw-r--r-- | test/lisp/net/tramp-archive-tests.el | 52 |
1 files changed, 51 insertions, 1 deletions
diff --git a/test/lisp/net/tramp-archive-tests.el b/test/lisp/net/tramp-archive-tests.el index 96c6a71097c..bebdf108c66 100644 --- a/test/lisp/net/tramp-archive-tests.el +++ b/test/lisp/net/tramp-archive-tests.el | |||
| @@ -779,7 +779,7 @@ This tests also `file-executable-p', `file-writable-p' and `set-file-modes'." | |||
| 779 | (delete-directory tmp-file) | 779 | (delete-directory tmp-file) |
| 780 | (should-not (file-exists-p tmp-file)))) | 780 | (should-not (file-exists-p tmp-file)))) |
| 781 | 781 | ||
| 782 | (ert-deftest tramp-archive-test40-archive-file-system-info () | 782 | (ert-deftest tramp-archive-test40-file-system-info () |
| 783 | "Check that `file-system-info' returns proper values." | 783 | "Check that `file-system-info' returns proper values." |
| 784 | (skip-unless tramp-gvfs-enabled) | 784 | (skip-unless tramp-gvfs-enabled) |
| 785 | ;; Since Emacs 27.1. | 785 | ;; Since Emacs 27.1. |
| @@ -796,6 +796,56 @@ This tests also `file-executable-p', `file-writable-p' and `set-file-modes'." | |||
| 796 | (zerop (nth 1 fsi)) | 796 | (zerop (nth 1 fsi)) |
| 797 | (zerop (nth 2 fsi)))))) | 797 | (zerop (nth 2 fsi)))))) |
| 798 | 798 | ||
| 799 | (ert-deftest tramp-archive-test42-auto-load () | ||
| 800 | "Check that `tramp-archive' autoloads properly." | ||
| 801 | (skip-unless tramp-gvfs-enabled) | ||
| 802 | |||
| 803 | (let ((default-directory (expand-file-name temporary-file-directory)) | ||
| 804 | (code | ||
| 805 | (format | ||
| 806 | "(message \"Tramp loaded: %%s\" (and (file-exists-p %S) t))" | ||
| 807 | tramp-archive-test-archive))) | ||
| 808 | (should | ||
| 809 | (string-match | ||
| 810 | "Tramp loaded: t[\n\r]+" | ||
| 811 | (shell-command-to-string | ||
| 812 | (format | ||
| 813 | "%s -batch -Q -L %s --eval %s" | ||
| 814 | (shell-quote-argument | ||
| 815 | (expand-file-name invocation-name invocation-directory)) | ||
| 816 | (mapconcat 'shell-quote-argument load-path " -L ") | ||
| 817 | (shell-quote-argument code))))))) | ||
| 818 | |||
| 819 | (ert-deftest tramp-archive-test42-delay-load () | ||
| 820 | "Check that `tramp-archive' is loaded lazily, only when needed." | ||
| 821 | (skip-unless tramp-gvfs-enabled) | ||
| 822 | |||
| 823 | ;; Tramp is neither loaded at Emacs startup, nor when completing a | ||
| 824 | ;; non archive file name like "/foo". Completing an archive file | ||
| 825 | ;; name like "/foo.tar/" autoloads Tramp, when `tramp-mode' is t. | ||
| 826 | (let ((default-directory (expand-file-name temporary-file-directory)) | ||
| 827 | (code | ||
| 828 | (format | ||
| 829 | "(progn \ | ||
| 830 | (message \"Tramp loaded: %%s\" (featurep 'tramp-archive)) \ | ||
| 831 | (file-name-all-completions %S \"/\") \ | ||
| 832 | (message \"Tramp loaded: %%s\" (featurep 'tramp-archive)) \ | ||
| 833 | (file-name-all-completions %S \"/\") \ | ||
| 834 | (message \"Tramp loaded: %%s\" (featurep 'tramp-archive)))" | ||
| 835 | tramp-archive-test-file-archive | ||
| 836 | tramp-archive-test-archive))) | ||
| 837 | ;; Tramp doesn't load when `tramp-mode' is nil. | ||
| 838 | (should | ||
| 839 | (string-match | ||
| 840 | "Tramp loaded: nil[\n\r]+Tramp loaded: nil[\n\r]+Tramp loaded: t[\n\r]+" | ||
| 841 | (shell-command-to-string | ||
| 842 | (format | ||
| 843 | "%s -batch -Q -L %s --eval %s" | ||
| 844 | (shell-quote-argument | ||
| 845 | (expand-file-name invocation-name invocation-directory)) | ||
| 846 | (mapconcat 'shell-quote-argument load-path " -L ") | ||
| 847 | (shell-quote-argument code))))))) | ||
| 848 | |||
| 799 | (ert-deftest tramp-archive-test99-libarchive-tests () | 849 | (ert-deftest tramp-archive-test99-libarchive-tests () |
| 800 | "Run tests of libarchive test files." | 850 | "Run tests of libarchive test files." |
| 801 | :tags '(:expensive-test) | 851 | :tags '(:expensive-test) |