aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorMichael Albinus2016-05-07 22:52:30 +0200
committerMichael Albinus2016-05-07 22:52:30 +0200
commit97776f295d652aff97be91431ad53db5618ad2a2 (patch)
tree8d06804b042c05c25b80be874753dfdf9a1686c2 /test
parent2ac39b069919bf71e614202aa96194c86934988c (diff)
downloademacs-97776f295d652aff97be91431ad53db5618ad2a2.tar.gz
emacs-97776f295d652aff97be91431ad53db5618ad2a2.zip
Continue to fix Bug#10085
* lisp/net/tramp.el (tramp-completion-file-name-handler-alist) <expand-file-name>: Add handler. (tramp-completion-handle-expand-file-name): New defun. (tramp-handle-file-name-as-directory): Handle completion mode case. * test/lisp/net/tramp-tests.el (tramp-test06-directory-file-name): Fix test. (tramp-test24-file-name-completion): Extend test.
Diffstat (limited to 'test')
-rw-r--r--test/lisp/net/tramp-tests.el67
1 files changed, 48 insertions, 19 deletions
diff --git a/test/lisp/net/tramp-tests.el b/test/lisp/net/tramp-tests.el
index efb19e9f506..a85eed0302a 100644
--- a/test/lisp/net/tramp-tests.el
+++ b/test/lisp/net/tramp-tests.el
@@ -649,7 +649,9 @@ This checks also `file-name-as-directory', `file-name-directory',
649 (setq file (format "/%s:" file)) 649 (setq file (format "/%s:" file))
650 (should (string-equal (directory-file-name file) file)) 650 (should (string-equal (directory-file-name file) file))
651 (should 651 (should
652 (string-equal (file-name-as-directory file) (concat file "./"))) 652 (string-equal
653 (file-name-as-directory file)
654 (if (tramp-completion-mode-p) file (concat file "./"))))
653 (should (string-equal (file-name-directory file) file)) 655 (should (string-equal (file-name-directory file) file))
654 (should (string-equal (file-name-nondirectory file) ""))))))) 656 (should (string-equal (file-name-nondirectory file) "")))))))
655 657
@@ -1367,25 +1369,52 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'."
1367 "Check `file-name-completion' and `file-name-all-completions'." 1369 "Check `file-name-completion' and `file-name-all-completions'."
1368 (skip-unless (tramp--test-enabled)) 1370 (skip-unless (tramp--test-enabled))
1369 1371
1370 (let ((tmp-name (tramp--test-make-temp-name))) 1372 (dolist (n-e '(nil t))
1371 (unwind-protect 1373 (let ((non-essential n-e)
1372 (progn 1374 (tmp-name (tramp--test-make-temp-name))
1373 (make-directory tmp-name) 1375 (method (file-remote-p tramp-test-temporary-file-directory 'method))
1374 (should (file-directory-p tmp-name)) 1376 (host (file-remote-p tramp-test-temporary-file-directory 'host)))
1375 (write-region "foo" nil (expand-file-name "foo" tmp-name)) 1377
1376 (write-region "bar" nil (expand-file-name "bold" tmp-name)) 1378 (unwind-protect
1377 (make-directory (expand-file-name "boz" tmp-name)) 1379 (progn
1378 (should (equal (file-name-completion "fo" tmp-name) "foo")) 1380 ;; Method and host name in completion mode.
1379 (should (equal (file-name-completion "b" tmp-name) "bo")) 1381 (when (tramp-completion-mode-p)
1380 (should 1382 (unless (zerop (length method))
1381 (equal (file-name-completion "b" tmp-name 'file-directory-p) "boz/")) 1383 (should
1382 (should (equal (file-name-all-completions "fo" tmp-name) '("foo"))) 1384 (member
1383 (should 1385 (format "%s:" method)
1384 (equal (sort (file-name-all-completions "b" tmp-name) 'string-lessp) 1386 (file-name-all-completions (substring method 0 1) "/"))))
1385 '("bold" "boz/")))) 1387 (unless (zerop (length host))
1388 (should
1389 (member
1390 (format "%s:" host)
1391 (file-name-all-completions (substring host 0 1) "/"))))
1392 (unless (or (zerop (length method)) (zerop (length host)))
1393 (should
1394 (member
1395 (format "%s:" host)
1396 (file-name-all-completions
1397 (substring host 0 1) (format "/%s:" method))))))
1398
1399 ;; Local files.
1400 (make-directory tmp-name)
1401 (should (file-directory-p tmp-name))
1402 (write-region "foo" nil (expand-file-name "foo" tmp-name))
1403 (write-region "bar" nil (expand-file-name "bold" tmp-name))
1404 (make-directory (expand-file-name "boz" tmp-name))
1405 (should (equal (file-name-completion "fo" tmp-name) "foo"))
1406 (should (equal (file-name-completion "b" tmp-name) "bo"))
1407 (should
1408 (equal
1409 (file-name-completion "b" tmp-name 'file-directory-p) "boz/"))
1410 (should (equal (file-name-all-completions "fo" tmp-name) '("foo")))
1411 (should
1412 (equal
1413 (sort (file-name-all-completions "b" tmp-name) 'string-lessp)
1414 '("bold" "boz/"))))
1386 1415
1387 ;; Cleanup. 1416 ;; Cleanup.
1388 (ignore-errors (delete-directory tmp-name 'recursive))))) 1417 (ignore-errors (delete-directory tmp-name 'recursive))))))
1389 1418
1390(ert-deftest tramp-test25-load () 1419(ert-deftest tramp-test25-load ()
1391 "Check `load'." 1420 "Check `load'."