"\\(-\\|[^/|:]\\{2,\\}\\)"
;; At least one character for method.
"[^/|:]+")
- ":\\'")
+ ":")
"Regular expression matching file names handled by Tramp autoload.
It must match the initial `tramp-syntax' settings. It should not
match file names at root of the underlying local file system,
'tramp-autoload-file-name-handler))
(put 'tramp-autoload-file-name-handler 'safe-magic t)))
-;;;###autoload
-(tramp-register-autoload-file-name-handlers)
+;;;###autoload (tramp-register-autoload-file-name-handlers)
(defun tramp-use-absolute-autoload-file-names ()
"Change Tramp autoload objects to use absolute file names.
(skip-unless (tramp--test-enabled))
;; We test it only for the mock-up connection; otherwise there might
;; be problems with the used ports.
- (skip-unless
- (and
- (eq tramp-syntax 'default)
- (string-equal
- "mock" (file-remote-p tramp-test-temporary-file-directory 'method))))
+ (skip-unless (and (eq tramp-syntax 'default)
+ (tramp--test-mock-p)))
;; We force a reconnect, in order to have a clean environment.
(dolist (dir `(,tramp-test-temporary-file-directory
(file-truename tramp-test-temporary-file-directory) nil
(string-match "^HP-UX" (tramp-get-connection-property v "uname" ""))))
+(defun tramp--test-mock-p ()
+ "Check, whether the mock method is used.
+This does not support external Emacs calls."
+ (string-equal
+ "mock" (file-remote-p tramp-test-temporary-file-directory 'method)))
+
(defun tramp--test-rsync-p ()
"Check, whether the rsync method is used.
This does not support special file names."
;; We must distinguish due to performance reasons.
(timer-operation
(cond
- ((string-equal "mock" (file-remote-p tmp-name 'method))
- 'vc-registered)
+ ((tramp--test-mock-p) 'vc-registered)
(t 'file-attributes)))
timer buffers kill-buffer-query-functions)
(ignore-errors (cancel-timer timer))
(ignore-errors (delete-directory tmp-name 'recursive))))))
-(ert-deftest tramp-test42-recursive-load ()
+(ert-deftest tramp-test42-auto-load ()
+ "Check that Tramp autoloads properly."
+ (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)))
+ (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-test43-recursive-load ()
"Check that Tramp does not fail due to recursive load."
(skip-unless (tramp--test-enabled))
(mapconcat 'shell-quote-argument load-path " -L ")
(shell-quote-argument code))))))))
-(ert-deftest tramp-test43-remote-load-path ()
+(ert-deftest tramp-test44-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
(mapconcat 'shell-quote-argument load-path " -L ")
(shell-quote-argument code)))))))
-(ert-deftest tramp-test44-delay-load ()
+(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
(mapconcat 'shell-quote-argument load-path " -L ")
(shell-quote-argument (format code tm)))))))))
-(ert-deftest tramp-test45-unload ()
+(ert-deftest tramp-test46-unload ()
"Check that Tramp and its subpackages unload completely.
Since it unloads Tramp, it shall be the last test to run."
:tags '(:expensive-test)