From: Eli Zaretskii Date: Sun, 13 Apr 2025 09:12:13 +0000 (+0300) Subject: ; Fix last change X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=87a7f0d9dc3a3b48e66bfab19ddeeb7b53eab916;p=emacs.git ; Fix last change * test/lisp/url/url-parse-tests.el (url-generic-parse-url/ms-windows-file-uri-hanlding): Reformat and fix the test on MS-Windows. (cherry picked from commit c76892edd28a7bfd7c303c3161d7ddf41c646541) --- diff --git a/test/lisp/url/url-parse-tests.el b/test/lisp/url/url-parse-tests.el index 8d57190ac32..16c811da31b 100644 --- a/test/lisp/url/url-parse-tests.el +++ b/test/lisp/url/url-parse-tests.el @@ -167,25 +167,35 @@ "/фыва/" nil nil t)))) (ert-deftest url-generic-parse-url/ms-windows-file-uri-hanlding () - "bug#76982 Make an exception if a URI refers to a filename and it \"looks like\" a Windows path: strip the leading /" - (should (equal (url-generic-parse-url "file:///c:/windows-path") (url-parse-make-urlobj "file" nil nil "" nil "c:/windows-path" nil nil t))) - (should (equal (url-filename (url-generic-parse-url "file:///c:/directory/file.txt")) "c:/directory/file.txt")) - (should (equal (url-recreate-url (url-parse-make-urlobj "file" nil nil "" nil "c:/directory/file.txt" nil nil t)) "file:///c:/directory/file.txt")) + "Make an exception if a file:// URI \"looks like\" a Windows file." + (should (equal (url-generic-parse-url "file:///c:/windows-path") + (url-parse-make-urlobj "file" nil nil "" nil + "c:/windows-path" nil nil t))) + (should (equal (url-filename (url-generic-parse-url + "file:///c:/directory/file.txt")) + "c:/directory/file.txt")) + (should (equal (url-recreate-url + (url-parse-make-urlobj "file" nil nil "" nil + "c:/directory/file.txt" nil nil t)) + "file:///c:/directory/file.txt")) ;; https://www.rfc-editor.org/rfc/rfc8089.html#appendix-E.2 - (should (equal (url-generic-parse-url "file:c:/path/to/file") (url-parse-make-urlobj "file" nil nil nil nil "c:/path/to/file" nil nil nil))) - (should (equal (url-recreate-url (url-parse-make-urlobj "file" nil nil nil nil "c:/path/to/file" nil nil nil)) "file:c:/path/to/file")) + (should (equal (url-generic-parse-url "file:c:/path/to/file") + (url-parse-make-urlobj "file" nil nil nil nil + "c:/path/to/file" nil nil nil))) + (should (equal (url-recreate-url + (url-parse-make-urlobj "file" nil nil nil nil + "c:/path/to/file" nil nil nil)) + (if (memq system-type '(windows-nt ms-dos)) + "file:/c:/path/to/file" + "file:c:/path/to/file"))) ;; accept backslashes too - (should (equal (url-filename (url-generic-parse-url "file:///c:\\directory\\file.txt")) "c:\\directory\\file.txt")) + (should (equal (url-filename + (url-generic-parse-url "file:///c:\\directory\\file.txt")) + "c:\\directory\\file.txt")) ;; - (should (equal (url-filename (url-generic-parse-url "file://localhost/c:/path/to/file")) "c:/path/to/file")) - ) - - - - - - - + (should (equal (url-filename + (url-generic-parse-url "file://localhost/c:/path/to/file")) + "c:/path/to/file"))) (provide 'url-parse-tests)