Adapt tests in tramp-archive-tests.el
* test/lisp/net/tramp-archive-tests.el (tramp-archive-test05-expand-file-name) (tramp-archive-test06-directory-file-name): Adapt tests.
This commit is contained in:
parent
82551f243f
commit
9e7681516f
1 changed files with 51 additions and 20 deletions
|
@ -292,15 +292,26 @@ variables, so we check the Emacs version directly."
|
|||
"Check `expand-file-name'."
|
||||
(should
|
||||
(string-equal
|
||||
(expand-file-name "/foo.tar/path/./file") "/foo.tar/path/file"))
|
||||
(expand-file-name (concat tramp-archive-test-archive "path/./file"))
|
||||
(concat tramp-archive-test-archive "path/file")))
|
||||
(should
|
||||
(string-equal (expand-file-name "/foo.tar/path/../file") "/foo.tar/file"))
|
||||
(string-equal
|
||||
(expand-file-name (concat tramp-archive-test-archive "path/../file"))
|
||||
(concat tramp-archive-test-archive "file")))
|
||||
;; `expand-file-name' does not care "~/" in archive file names.
|
||||
(should
|
||||
(string-equal (expand-file-name "/foo.tar/~/file") "/foo.tar/~/file"))
|
||||
(string-equal
|
||||
(expand-file-name (concat tramp-archive-test-archive "~/file"))
|
||||
(concat tramp-archive-test-archive "~/file")))
|
||||
;; `expand-file-name' does not care file archive boundaries.
|
||||
(should (string-equal (expand-file-name "/foo.tar/./file") "/foo.tar/file"))
|
||||
(should (string-equal (expand-file-name "/foo.tar/../file") "/file")))
|
||||
(should
|
||||
(string-equal
|
||||
(expand-file-name (concat tramp-archive-test-archive "./file"))
|
||||
(concat tramp-archive-test-archive "file")))
|
||||
(should
|
||||
(string-equal
|
||||
(expand-file-name (concat tramp-archive-test-archive "../file"))
|
||||
(concat (ert-resource-directory) "file"))))
|
||||
|
||||
;; This test is inspired by Bug#30293.
|
||||
(ert-deftest tramp-archive-test05-expand-file-name-non-archive-directory ()
|
||||
|
@ -321,43 +332,63 @@ They shall still be supported"
|
|||
"Check `directory-file-name'.
|
||||
This checks also `file-name-as-directory', `file-name-directory',
|
||||
`file-name-nondirectory' and `unhandled-file-name-directory'."
|
||||
:tags '(:unstable) ;; Temporarily.
|
||||
(skip-unless tramp-archive-enabled)
|
||||
|
||||
(should
|
||||
(string-equal
|
||||
(directory-file-name "/foo.tar/path/to/file") "/foo.tar/path/to/file"))
|
||||
(directory-file-name (concat tramp-archive-test-archive "path/to/file"))
|
||||
(concat tramp-archive-test-archive "path/to/file")))
|
||||
(should
|
||||
(string-equal
|
||||
(directory-file-name "/foo.tar/path/to/file/") "/foo.tar/path/to/file"))
|
||||
(directory-file-name (concat tramp-archive-test-archive "path/to/file/"))
|
||||
(concat tramp-archive-test-archive "path/to/file")))
|
||||
;; `directory-file-name' does not leave file archive boundaries.
|
||||
(should (string-equal (directory-file-name "/foo.tar/") "/foo.tar/"))
|
||||
(should
|
||||
(string-equal
|
||||
(directory-file-name tramp-archive-test-archive) tramp-archive-test-archive))
|
||||
|
||||
(should
|
||||
(string-equal
|
||||
(file-name-as-directory "/foo.tar/path/to/file") "/foo.tar/path/to/file/"))
|
||||
(file-name-as-directory (concat tramp-archive-test-archive "path/to/file"))
|
||||
(concat tramp-archive-test-archive "path/to/file/")))
|
||||
(should
|
||||
(string-equal
|
||||
(file-name-as-directory "/foo.tar/path/to/file/") "/foo.tar/path/to/file/"))
|
||||
(should (string-equal (file-name-as-directory "/foo.tar/") "/foo.tar/"))
|
||||
(should (string-equal (file-name-as-directory "/foo.tar") "/foo.tar/"))
|
||||
(file-name-as-directory (concat tramp-archive-test-archive "path/to/file/"))
|
||||
(concat tramp-archive-test-archive "path/to/file/")))
|
||||
(should
|
||||
(string-equal
|
||||
(file-name-as-directory tramp-archive-test-archive)
|
||||
tramp-archive-test-archive))
|
||||
(should
|
||||
(string-equal
|
||||
(file-name-as-directory tramp-archive-test-file-archive)
|
||||
tramp-archive-test-archive))
|
||||
|
||||
(should
|
||||
(string-equal
|
||||
(file-name-directory "/foo.tar/path/to/file") "/foo.tar/path/to/"))
|
||||
(file-name-directory (concat tramp-archive-test-archive "path/to/file"))
|
||||
(concat tramp-archive-test-archive "path/to/")))
|
||||
(should
|
||||
(string-equal
|
||||
(file-name-directory "/foo.tar/path/to/file/") "/foo.tar/path/to/file/"))
|
||||
(should (string-equal (file-name-directory "/foo.tar/") "/foo.tar/"))
|
||||
(file-name-directory (concat tramp-archive-test-archive "path/to/file/"))
|
||||
(concat tramp-archive-test-archive "path/to/file/")))
|
||||
(should
|
||||
(string-equal
|
||||
(file-name-directory tramp-archive-test-archive) tramp-archive-test-archive))
|
||||
|
||||
(should
|
||||
(string-equal (file-name-nondirectory "/foo.tar/path/to/file") "file"))
|
||||
(string-equal
|
||||
(file-name-nondirectory (concat tramp-archive-test-archive "path/to/file"))
|
||||
"file"))
|
||||
(should
|
||||
(string-equal (file-name-nondirectory "/foo.tar/path/to/file/") ""))
|
||||
(should (string-equal (file-name-nondirectory "/foo.tar/") ""))
|
||||
(string-equal
|
||||
(file-name-nondirectory (concat tramp-archive-test-archive "path/to/file/"))
|
||||
""))
|
||||
(should (string-equal (file-name-nondirectory tramp-archive-test-archive) ""))
|
||||
|
||||
(should-not
|
||||
(unhandled-file-name-directory "/foo.tar/path/to/file")))
|
||||
(unhandled-file-name-directory
|
||||
(concat tramp-archive-test-archive "path/to/file"))))
|
||||
|
||||
(ert-deftest tramp-archive-test07-file-exists-p ()
|
||||
"Check `file-exist-p', `write-region' and `delete-file'."
|
||||
|
|
Loading…
Add table
Reference in a new issue