summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorMichael Albinus <michael.albinus@gmx.de>2017-10-24 11:55:20 +0200
committerMichael Albinus <michael.albinus@gmx.de>2017-10-24 11:55:20 +0200
commit46f2ee0d4c7123941bb8decc5e947e356099d7b6 (patch)
tree19d227495dba3b8ca219d1ca0ead64bd550c27d1 /test
parentb51009d7f02b796bcdf9b0893bc4ad348460e844 (diff)
downloademacs-46f2ee0d4c7123941bb8decc5e947e356099d7b6.tar.gz
* test/lisp/net/tramp-tests.el (tramp-test41-delay-load): New test.
(tramp-test42-unload): Rename.
Diffstat (limited to 'test')
-rw-r--r--test/lisp/net/tramp-tests.el24
1 files changed, 23 insertions, 1 deletions
diff --git a/test/lisp/net/tramp-tests.el b/test/lisp/net/tramp-tests.el
index fdd816dae2e..7e644e6a2bb 100644
--- a/test/lisp/net/tramp-tests.el
+++ b/test/lisp/net/tramp-tests.el
@@ -4333,7 +4333,29 @@ process sentinels. They shall not disturb each other."
(mapconcat 'shell-quote-argument load-path " -L ")
(shell-quote-argument code)))))))
-(ert-deftest tramp-test41-unload ()
+(ert-deftest tramp-test41-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.
+ (let ((code
+ "(progn \
+ (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)))"))
+ (should
+ (string-match
+ "Tramp loaded: nil[\n\r]+Tramp loaded: nil[\n\r]+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-unload ()
"Check that Tramp and its subpackages unload completely.
Since it unloads Tramp, it shall be the last test to run."
:tags '(:expensive-test)