emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] emacs-26 46f2ee0: * test/lisp/net/tramp-tests.el (tramp-te


From: Michael Albinus
Subject: [Emacs-diffs] emacs-26 46f2ee0: * test/lisp/net/tramp-tests.el (tramp-test41-delay-load): New test.
Date: Tue, 24 Oct 2017 05:57:14 -0400 (EDT)

branch: emacs-26
commit 46f2ee0d4c7123941bb8decc5e947e356099d7b6
Author: Michael Albinus <address@hidden>
Commit: Michael Albinus <address@hidden>

    * test/lisp/net/tramp-tests.el (tramp-test41-delay-load): New test.
    
    (tramp-test42-unload): Rename.
---
 test/lisp/net/tramp-tests.el | 24 +++++++++++++++++++++++-
 1 file changed, 23 insertions(+), 1 deletion(-)

diff --git a/test/lisp/net/tramp-tests.el b/test/lisp/net/tramp-tests.el
index fdd816d..7e644e6 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)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]