mirror of
git://git.sv.gnu.org/emacs.git
synced 2026-04-27 08:43:40 -07:00
; 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.
This commit is contained in:
parent
fec6e16f14
commit
c76892edd2
1 changed files with 26 additions and 16 deletions
|
|
@ -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)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue