From 9e7681516f233784bc1fe88e290d480c22f22704 Mon Sep 17 00:00:00 2001 From: Michael Albinus Date: Sun, 20 Jun 2021 17:50:52 +0200 Subject: [PATCH] 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. --- test/lisp/net/tramp-archive-tests.el | 71 ++++++++++++++++++++-------- 1 file changed, 51 insertions(+), 20 deletions(-) diff --git a/test/lisp/net/tramp-archive-tests.el b/test/lisp/net/tramp-archive-tests.el index 9a97974c936..ca1163bb775 100644 --- a/test/lisp/net/tramp-archive-tests.el +++ b/test/lisp/net/tramp-archive-tests.el @@ -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'." -- 2.39.2