diff options
author | Eli Zaretskii <eliz@gnu.org> | 2017-09-08 10:51:14 +0300 |
---|---|---|
committer | Eli Zaretskii <eliz@gnu.org> | 2017-09-08 10:51:14 +0300 |
commit | e2a10d7fa8092ef51a3b61a363061e37224e2ca1 (patch) | |
tree | e6efaca41d7e006f88250e44213eb9fbaf2c41ae /test/src/fileio-tests.el | |
parent | 442fe111436264e1a610fbf5686ccf1314407d4a (diff) | |
download | emacs-e2a10d7fa8092ef51a3b61a363061e37224e2ca1.tar.gz |
Fix 'directory-file-name' on DOS_NT systems as well
* src/fileio.c (directory_file_name) [DOS_NT]: Fix the DOS_NT case
to be consistent with last change.
* test/src/fileio-tests.el (fileio-tests--odd-symlink-chars):
Disable on MS-Windows.
(fileio-tests--directory-file-name-dos-nt)
(fileio-tests--file-name-as-directory-dos-nt): New tests.
Diffstat (limited to 'test/src/fileio-tests.el')
-rw-r--r-- | test/src/fileio-tests.el | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/test/src/fileio-tests.el b/test/src/fileio-tests.el index ac5d533e63b..7ac70a58961 100644 --- a/test/src/fileio-tests.el +++ b/test/src/fileio-tests.el @@ -43,6 +43,10 @@ (ert-deftest fileio-tests--odd-symlink-chars () "Check that any non-NULL ASCII character can appear in a symlink. Also check that an encoding error can appear in a symlink." + ;; Some Windows versions don't support symlinks, and those which do + ;; will pop up UAC elevation prompts, so we disable this test on + ;; MS-Windows. + (skip-unless (not (eq system-type 'windows-nt))) (should (equal nil (fileio-tests--symlink-failure)))) (ert-deftest fileio-tests--directory-file-name () @@ -54,6 +58,17 @@ Also check that an encoding error can appear in a symlink." (should (equal (directory-file-name "/abc/") "/abc")) (should (equal (directory-file-name "/abc//") "/abc"))) +(ert-deftest fileio-tests--directory-file-name-dos-nt () + "Like fileio-tests--directory-file-name, but for DOS_NT systems." + (skip-unless (memq system-type '(ms-dos windows-nt))) + (should (equal (directory-file-name "d:/") "d:/")) + (should (equal (directory-file-name "d://") "d:/")) + (should (equal (directory-file-name "d:///") "d:/")) + (should (equal (directory-file-name "d:////") "d:/")) + (should (equal (directory-file-name "d:/abc") "d:/abc")) + (should (equal (directory-file-name "d:/abc/") "d:/abc")) + (should (equal (directory-file-name "d:/abc//") "d:/abc"))) + (ert-deftest fileio-tests--file-name-as-directory () (should (equal (file-name-as-directory "") "./")) (should (equal (file-name-as-directory "/") "/")) @@ -63,3 +78,18 @@ Also check that an encoding error can appear in a symlink." (should (equal (file-name-as-directory "/abc") "/abc/")) (should (equal (file-name-as-directory "/abc/") "/abc/")) (should (equal (file-name-as-directory "/abc//") "/abc//"))) + +(ert-deftest fileio-tests--file-name-as-directory-dos-nt () + "Like fileio-tests--file-name-as-directory, but for DOS_NT systems." + (skip-unless (memq system-type '(ms-dos windows-nt))) + (should (equal (file-name-as-directory "d:/") "d:/")) + (should (equal (file-name-as-directory "d:\\") "d:/")) + (should (equal (file-name-as-directory "d://") "d://")) + (should (equal (file-name-as-directory "d:///") "d:///")) + (should (equal (file-name-as-directory "d:////") "d:////")) + (should (equal (file-name-as-directory "d:\\\\\\\\") "d:////")) + (should (equal (file-name-as-directory "d:/abc") "d:/abc/")) + (should (equal (file-name-as-directory "D:\\abc") "d:/abc/")) + (should (equal (file-name-as-directory "d:/abc/") "d:/abc/")) + (should (equal (file-name-as-directory "D:\\abc/") "d:/abc/")) + (should (equal (file-name-as-directory "D:/abc//") "d:/abc//"))) |