diff options
| author | Michael Albinus | 2018-02-04 13:25:10 +0100 |
|---|---|---|
| committer | Michael Albinus | 2018-02-04 13:25:10 +0100 |
| commit | d2630e456923d2bd70fdd59267fe6e3d8eeb69ca (patch) | |
| tree | ca1fdb4b4048a2a16a4db53e81b7e8cc6af15b71 /test | |
| parent | 327d251f8a857350a78029c31c7ab3f9797cc727 (diff) | |
| download | emacs-d2630e456923d2bd70fdd59267fe6e3d8eeb69ca.tar.gz emacs-d2630e456923d2bd70fdd59267fe6e3d8eeb69ca.zip | |
Make tramp-archive fit for older Emacsen
* lisp/net/tramp-archive.el (tramp-archive-enabled)
(tramp-archive-file-name-handler-alist)
(tramp-archive-file-name-handler): Adapt docstring.
(tramp-register-archive-file-name-handler): Remove it from
`after-init-hook' when unloading.
(tramp-archive-gvfs-host): New defsubst.
(tramp-archive-dissect-file-name): Use it.
* lisp/net/tramp-cmds.el (tramp-cleanup-all-connections):
Check that `tramp-archive-enabled' is bound.
* test/lisp/net/tramp-archive-tests.el (tramp-archive-test42-auto-load):
Check also that tramp-archive is not loaded when Tramp is loaded.
(tramp-archive-test42-delay-load): Adapt test messages.
Diffstat (limited to 'test')
| -rw-r--r-- | test/lisp/net/tramp-archive-tests.el | 49 |
1 files changed, 30 insertions, 19 deletions
diff --git a/test/lisp/net/tramp-archive-tests.el b/test/lisp/net/tramp-archive-tests.el index e4ae1217002..33916f82dac 100644 --- a/test/lisp/net/tramp-archive-tests.el +++ b/test/lisp/net/tramp-archive-tests.el | |||
| @@ -808,21 +808,29 @@ This tests also `file-executable-p', `file-writable-p' and `set-file-modes'." | |||
| 808 | ;; Autoloading tramp-archive works since Emacs 27.1. | 808 | ;; Autoloading tramp-archive works since Emacs 27.1. |
| 809 | (skip-unless (tramp-archive--test-emacs27-p)) | 809 | (skip-unless (tramp-archive--test-emacs27-p)) |
| 810 | 810 | ||
| 811 | ;; tramp-archive is neither loaded at Emacs startup, nor when | ||
| 812 | ;; loading a file like "/ssh::" (which loads Tramp). | ||
| 811 | (let ((default-directory (expand-file-name temporary-file-directory)) | 813 | (let ((default-directory (expand-file-name temporary-file-directory)) |
| 812 | (code | 814 | (code |
| 815 | "(progn \ | ||
| 816 | (message \"tramp-archive loaded: %%s %%s\" \ | ||
| 817 | (featurep 'tramp) (featurep 'tramp-archive)) \ | ||
| 818 | (file-attributes %S \"/\") \ | ||
| 819 | (message \"tramp-archive loaded: %%s %%s\" \ | ||
| 820 | (featurep 'tramp) (featurep 'tramp-archive)))")) | ||
| 821 | (dolist (file `("/ssh::foo" ,(concat tramp-archive-test-archive "foo"))) | ||
| 822 | (should | ||
| 823 | (string-match | ||
| 824 | (format | ||
| 825 | "tramp-archive loaded: nil nil[[:ascii:]]+tramp-archive loaded: t %s" | ||
| 826 | (tramp-archive-file-name-p file)) | ||
| 827 | (shell-command-to-string | ||
| 813 | (format | 828 | (format |
| 814 | "(message \"Tramp loaded: %%s\" (and (file-exists-p %S) t))" | 829 | "%s -batch -Q -L %s --eval %s" |
| 815 | tramp-archive-test-archive))) | 830 | (shell-quote-argument |
| 816 | (should | 831 | (expand-file-name invocation-name invocation-directory)) |
| 817 | (string-match | 832 | (mapconcat 'shell-quote-argument load-path " -L ") |
| 818 | "Tramp loaded: t[\n\r]+" | 833 | (shell-quote-argument (format code file))))))))) |
| 819 | (shell-command-to-string | ||
| 820 | (format | ||
| 821 | "%s -batch -Q -L %s --eval %s" | ||
| 822 | (shell-quote-argument | ||
| 823 | (expand-file-name invocation-name invocation-directory)) | ||
| 824 | (mapconcat 'shell-quote-argument load-path " -L ") | ||
| 825 | (shell-quote-argument code))))))) | ||
| 826 | 834 | ||
| 827 | (ert-deftest tramp-archive-test42-delay-load () | 835 | (ert-deftest tramp-archive-test42-delay-load () |
| 828 | "Check that `tramp-archive' is loaded lazily, only when needed." | 836 | "Check that `tramp-archive' is loaded lazily, only when needed." |
| @@ -836,18 +844,21 @@ This tests also `file-executable-p', `file-writable-p' and `set-file-modes'." | |||
| 836 | (let ((default-directory (expand-file-name temporary-file-directory)) | 844 | (let ((default-directory (expand-file-name temporary-file-directory)) |
| 837 | (code | 845 | (code |
| 838 | "(progn \ | 846 | "(progn \ |
| 839 | (setq tramp-archive-enabled %s) \ | 847 | (setq tramp-archive-enabled %s) \ |
| 840 | (message \"Tramp loaded: %%s\" (featurep 'tramp-archive)) \ | 848 | (message \"tramp-archive loaded: %%s\" \ |
| 841 | (find-file %S \"/\") \ | 849 | (featurep 'tramp-archive)) \ |
| 842 | (message \"Tramp loaded: %%s\" (featurep 'tramp-archive)) \ | 850 | (file-attributes %S \"/\") \ |
| 843 | (file-attributes %S \"/\") \ | 851 | (message \"tramp-archive loaded: %%s\" \ |
| 844 | (message \"Tramp loaded: %%s\" (featurep 'tramp-archive)))")) | 852 | (featurep 'tramp-archive)) \ |
| 853 | (file-attributes %S \"/\") \ | ||
| 854 | (message \"tramp-archive loaded: %%s\" \ | ||
| 855 | (featurep 'tramp-archive)))")) | ||
| 845 | ;; tramp-archive doesn't load when `tramp-archive-enabled' is nil. | 856 | ;; tramp-archive doesn't load when `tramp-archive-enabled' is nil. |
| 846 | (dolist (tae '(t nil)) | 857 | (dolist (tae '(t nil)) |
| 847 | (should | 858 | (should |
| 848 | (string-match | 859 | (string-match |
| 849 | (format | 860 | (format |
| 850 | "Tramp loaded: nil[[:ascii:]]+Tramp loaded: nil[[:ascii:]]+Tramp loaded: %s" | 861 | "tramp-archive loaded: nil[[:ascii:]]+tramp-archive loaded: nil[[:ascii:]]+tramp-archive loaded: %s" |
| 851 | tae) | 862 | tae) |
| 852 | (shell-command-to-string | 863 | (shell-command-to-string |
| 853 | (format | 864 | (format |