Ignore:
Timestamp:
06/21/11 10:11:10 (11 years ago)
Author:
Mark Evenson
Message:

Fix problems with whitespace in JAR-PATHNAME.

For dealing with URI Encoding (also known as [Percent Encoding]() we
implement the following rules which were implicitly.

[Percent Encoding]: http://en.wikipedia.org/wiki/Percent-encoding

  1. All pathname components are represented "as is" without escaping.
  1. Namestrings are suitably escaped if the Pathname is a URL-PATHNAME

or a JAR-PATHNAME.

  1. Namestrings should all "round-trip":

(when (typep p 'pathname)

(equal (namestring p)

(namestring (pathname p))))

Users may use EXT:URI-ENCODE and EXT:URI-DECODE to access the escaping
rules in circumstances where they wish to manipulate PATHNAME
namestrings more directly.

All tests in JAR-PATHNAMES now pass.

Constructors for PATHNAME now produce ERROR rather than FILE-ERROR as
CLHS says "The type file-error consists of error conditions that occur
during an attempt to open or close a file, or during some low-level
transactions with a file system," which doesn't apply here.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/abcl/test/lisp/abcl/jar-pathname.lisp

    r13326 r13353  
    117117       ,@body)))
    118118
     119(defun jar-pathname-escaped (jar path)
     120  (pathname (format nil "jar:file:~A!/~A"
     121                    (ext:uri-encode (namestring jar)) path)))
     122
    119123(defmacro load-from-jar (jar path)
    120124  `(with-jar-file-init
    121        (load (format nil "jar:file:~A!/~A" ,jar ,path))))
     125       (load (jar-pathname-escaped ,jar ,path))))
    122126
    123127(deftest jar-pathname.load.1
     
    137141  t)
    138142
    139 (deftest jar-pathname.load.5
     143çu(deftest jar-pathname.load.5
    140144    (load-from-jar *tmp-jar-path* "eek.lisp")
    141145  t)
     
    170174
    171175(deftest jar-pathname.load.13
    172     (load-from-jar *tmp-jar-path* "a/b/foo bar.abcl")
     176    (signals-error
     177     (load-from-jar *tmp-jar-path* "a/b/foo bar.abcl")
     178     'error)
    173179  t)
    174180
    175181(deftest jar-pathname.load.14
    176     (load-from-jar *tmp-jar-path-whitespace* "a/b/foo.abcl")
     182    (load-from-jar *tmp-jar-path-whitespace* "a/b/bar.abcl")
    177183  t)
    178184
    179185(deftest jar-pathname.load.15
    180     (load-from-jar *tmp-jar-path-whitespace* "a/b/foo bar.abcl")
     186    (signals-error
     187     (load-from-jar *tmp-jar-path-whitespace* "a/b/foo bar.abcl")
     188     'error)
    181189  t)
    182190
     
    280288(deftest jar-pathname.merge-pathnames.2
    281289    (merge-pathnames
    282      "bar.abcl" #p"jar:file:baz.jar!/foo/")
     290     "bar.abcl" #p"jar:file:baz.jar!/foo/baz")
    283291  #p"jar:file:baz.jar!/foo/bar.abcl")
    284292
     
    405413       (equal s
    406414              (namestring (pathname s))))
    407      'file-error)
     415     'error)
    408416  t)
    409417
Note: See TracChangeset for help on using the changeset viewer.