Changeset 15437


Ignore:
Timestamp:
10/29/20 16:54:30 (3 years ago)
Author:
Mark Evenson
Message:

abcl/test/lisp: rework JAR-PATHNAME tests to reflect implementation

  • * *

ABCL/TEST/LISP JAR-PATHNAME now passing

TODO review entire file carefully

File:
1 edited

Legend:

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

    r15399 r15437  
    108108      (setf *tmp-jar-path-whitespace*
    109109            (merge-pathnames "baz.jar" *tmp-directory-whitespace*))
    110       (cl-fad-copy-file *tmp-jar-path* *tmp-jar-path-whitespace*)))
     110      (cl-fad-copy-file *tmp-jar-path* *tmp-jar-path-whitespace* :overwrite t)))
    111111  (values *tmp-jar-path* *tmp-jar-path-whitespace*))
    112112
     
    123123
    124124(defun load-from-jar (jar entry)
     125  (load (merge-jar-entry jar entry)))
     126
     127(defun merge-jar-entry (jar entry)
    125128  (let ((jar-pathname (if (ext:pathname-jar-p jar)
    126129                          jar
    127130                          (make-pathname :device (list jar)))))
    128     (load (merge-pathnames entry jar-pathname))))
    129 
    130 (deftest jar-pathname.load.1
    131   (with-jar-file-init
    132     (load-from-jar *tmp-jar-path* "__loader__._"))
    133   t)
    134 
    135 ;; Needs nested jars implementation
    136 (pushnew 'jar-pathname.load.2 *expected-failures*)
     131    (merge-pathnames entry jar-pathname)))
     132
     133
    137134(deftest jar-pathname.load.2
    138135  (with-jar-file-init
     
    140137  t)
    141138
    142 ;; Needs nested jars implementation
    143 (pushnew 'jar-pathname.load.3 *expected-failures*)
    144139(deftest jar-pathname.load.3
    145140  (with-jar-file-init
    146     (load-from-jar *tmp-jar-path* "bar.abcl"))
     141      (load-from-jar *tmp-jar-path* "bar.abcl"))
    147142  t)
    148143
    149144(deftest jar-pathname.load.4
    150145  (with-jar-file-init
    151     (load-from-jar *tmp-jar-path* "eek"))
     146      (load-from-jar *tmp-jar-path* "eek"))
    152147  t)
    153148
     
    163158  t)
    164159
    165 ;; Needs nested jars implementation
    166 (pushnew 'jar-pathname.load.7 *expected-failures*)
    167160(deftest jar-pathname.load.7
    168161  (with-jar-file-init
     
    170163  t)
    171164
    172 ;; Needs nested jars implementation
    173 (pushnew 'jar-pathname.load.8 *expected-failures*)
    174165(deftest jar-pathname.load.8
    175166  (with-jar-file-init
     
    184175(deftest jar-pathname.load.10
    185176  (with-jar-file-init
    186     (load-from-jar *tmp-jar-path* "a/b/eek.lisp"))
    187   t)
    188 
    189 ;; Needs nested jars implementation
    190 (pushnew 'jar-pathname.load.11 *expected-failures*)
     177      (load-from-jar *tmp-jar-path* "a/b/eek.lisp"))
     178  t)
     179
    191180(deftest jar-pathname.load.11
    192181  (with-jar-file-init
     
    194183  t)
    195184
    196 ;; Needs nested jars implementation
    197 (pushnew 'jar-pathname.load.12 *expected-failures*)
     185 
     186  #+(or) ;; URI encodings in namestring are not currently interpolated
    198187(deftest jar-pathname.load.12
    199   (with-jar-file-init
    200       (load-from-jar *tmp-jar-path* "a/b/foo%20bar.abcl"))
    201   t)
    202 
    203 ;; Needs nested jars implementation
    204 (pushnew 'jar-pathname.load.13 *expected-failures*)
     188    (with-jar-file-init
     189        (load-from-jar *tmp-jar-path* "a/b/foo%20bar.abcl"))
     190  t)
     191
    205192(deftest jar-pathname.load.13
    206   (signals-error
    207    (load-from-jar *tmp-jar-path* "a/b/foo bar.abcl")
    208    'error)
     193    (with-jar-file-init
     194        (load-from-jar *tmp-jar-path* "a/b/foo bar.abcl"))
    209195  t)
    210196
     
    219205  t)
    220206
    221 ;; Needs nested jars implementation
    222 (pushnew 'jar-pathname.load.16 *expected-failures*)
     207  #+(or) ;; URI encodings in namestring are not currently interpolated
    223208(deftest jar-pathname.load.16
    224209    (load-from-jar *tmp-jar-path-whitespace* "a/b/foo%20bar.abcl")
     
    229214
    230215(deftest jar-pathname.url.https.1
    231   (equalp
    232    *url-jar-pathname-base*
    233    (probe-file *url-jar-pathname-base*))
    234   t)
    235 
     216    (equalp
     217     *url-jar-pathname-base*
     218     (probe-file *url-jar-pathname-base*))
     219  t)
     220
     221(deftest jar-pathname.url.https.2
     222     (namestring (merge-pathnames "**" "jar:https://abcl.org/releases/1.7.1/abcl-contrib.jar!/"))
     223  "jar:https://abcl.org/releases/1.7.1/abcl-contrib.jar!/**")
     224
     225(deftest jar-pathname.url.https.3
     226    (not (null (probe-file #p"jar:https://abcl.org/releases/1.7.1/abcl-contrib.jar!/README.markdown")))
     227  t)
     228
     229(deftest jar-pathname.url.https.4
     230    (< 1 (length (directory #p"jar:https://abcl.org/releases/1.7.1/abcl-contrib.jar!/**/")))
     231  t)
     232   
    236233(deftest jar-pathname.probe-file.1
    237   (with-jar-file-init
    238       (let ((p
    239               (merge-pathnames "eek.lisp"
    240                                (make-pathname :device (list *tmp-jar-path*)))))
     234    (with-jar-file-init
     235        (let ((p (merge-jar-entry  *tmp-jar-path* "eek.lisp")))
     236          (not (null (probe-file p)))))
     237  t)
     238
     239(deftest jar-pathname.probe-file.2
     240  (with-jar-file-init
     241      (let ((p (merge-jar-entry *tmp-jar-path* "a/b/bar.abcl")))
    241242        (not (null (probe-file p)))))
    242243  t)
    243244
    244 (deftest jar-pathname.probe-file.2
    245   (with-jar-file-init
    246       (let ((p
    247               (merge-pathnames "a/b/bar.abcl"
    248                                (make-pathname :device (list *tmp-jar-path*)))))
    249         (not (null (probe-file p)))))
    250   t)
    251 
    252 #+(or) ;; needs nested pathnames
    253245(deftest jar-pathname.probe-file.3
    254     (let ((result
    255           (with-jar-file-init
    256               (probe-file "jar:jar:file:baz.jar!/a/b/bar.abcl!/bar._"))))
    257       (string=
    258        (if result (namestring result) "")
    259        (format nil "jar:jar:file:~Abaz.jar!/a/b/bar.abcl!/bar._"
    260                (namestring *tmp-directory*))))
     246    (with-jar-file-init
     247        (let ((p (make-pathname :device (list (pathname *tmp-jar-path*) #p"a/b/bar.abcl")
     248                                :directory '(:absolute)
     249                                :name "bar_1"
     250                                :type "cls")))
     251          (not (null (probe-file p)))))
    261252  t)
    262253
    263254(deftest jar-pathname.probe-file.4
    264255    (with-jar-file-init
    265       (let ((p
    266               (merge-pathnames "a/b/bar.abcl"
    267                                (make-pathname :device (list *tmp-jar-path*)))))
     256        (let ((p (merge-jar-entry *tmp-jar-path* "a/b/bar.abcl")))
     257          (not (null (probe-file p)))))
     258  t)
     259
     260(deftest jar-pathname.probe-file.5
     261  (with-jar-file-init
     262      (let ((p (merge-jar-entry *tmp-jar-path* "a/b/" )))
    268263        (not (null (probe-file p)))))
    269264  t)
    270265
    271 (deftest jar-pathname.probe-file.5
    272   (with-jar-file-init
    273       (let ((p
    274               (merge-pathnames "a/b/"
    275                                (make-pathname :device (list *tmp-jar-path*)))))
     266(deftest jar-pathname.probe-file.6
     267  (with-jar-file-init
     268      (let ((p (merge-jar-entry *tmp-jar-path* "d/e+f/bar.abcl")))
    276269        (not (null (probe-file p)))))
    277270  t)
    278271
    279 
    280 (deftest jar-pathname.probe-file.6
    281   (with-jar-file-init
    282       (let ((p
    283               (merge-pathnames "d/e+f/bar.abcl/"
    284                                (make-pathname :device (list *tmp-jar-path*)))))
    285         (not (null (probe-file p)))))
    286   t)
    287 
    288 
     272(deftest jar-pathname.probe-file.7
     273  (with-jar-file-init
     274      (not (null (probe-file (merge-jar-entry *tmp-jar-path* "__loader__._")))))
     275  t)
     276
     277
     278#+(or) ;; abcl-1.8.0 behavior is not to merge absolute pathname with JAR-PATHNAME defaults
    289279(deftest jar-pathname.merge-pathnames.1
    290   (merge-pathnames
    291    "/bar.abcl" #p"jar:file:/baz.jar!/foo")
     280  (merge-pathnames "/bar.abcl" #p"jar:file:/baz.jar!/foo")
    292281  #p"jar:file:/baz.jar!/bar.abcl")
    293282
    294283(deftest jar-pathname.merge-pathnames.2
    295   (merge-pathnames
    296    "bar.abcl" #p"jar:file:/baz.jar!/foo/baz")
    297   #p"jar:file:/baz.jar!/foo/bar.abcl")
     284  (namestring (merge-pathnames "bar.abcl" #p"jar:file:///baz.jar!/foo/baz"))
     285  "jar:file:///baz.jar!/foo/bar.abcl")
    298286
    299287(deftest jar-pathname.merge-pathnames.3
    300     (merge-pathnames
    301      "jar:file:/baz.jar!/foo" "bar")
    302   #p"jar:file:/baz.jar!/foo")
     288  (namestring (merge-pathnames "jar:file:///baz.jar!/foo" "bar"))
     289  "jar:file:///baz.jar!/foo")
    303290
    304291(deftest jar-pathname.merge-pathnames.4
    305     (merge-pathnames
    306      "jar:file:/baz.jar!/foo" "/a/b/c")
    307   #p"jar:file:/a/b/baz.jar!/foo")
     292    (namestring (merge-pathnames "jar:file:///baz.jar!/foo" "/a/b/c"))
     293  "jar:file:///baz.jar!/foo")
    308294
    309295;;; Under win32, we get the device in the merged path
     
    311297(push 'jar-pathname.merge-pathnames.5 *expected-failures*)
    312298(deftest jar-pathname.merge-pathnames.5
    313   (merge-pathnames "jar:file:/a/b/c/foo.jar!/bar/baz.lisp")
    314   #p"jar:file:/a/b/c/foo.jar!/bar/baz.lisp")
     299  (namestring (merge-pathnames "jar:file:///a/b/c/foo.jar!/bar/baz.lisp"))
     300  "jar:file:///a/b/c/foo.jar!/bar/baz.lisp")
    315301
    316302(deftest jar-pathname.truename.1
     
    345331  "foo" "abcl")
    346332
    347 #+(or) ;;; FIXME 'Nested Jar URLs are not supported' regression from abcl-1.5.0
    348333(deftest jar-pathname.4
    349334    (let* ((p #p"jar:jar:file:a/baz.jar!/b/c/foo.abcl!/this/that/foo-20.cls")
     
    358343  (:absolute "this" "that") "foo-20" "cls")
    359344
    360 #+(or) ;;; FIXME 'Nested Jar URLs are not supported' regression from abcl-1.5.0
    361345(deftest jar-pathname.5
    362346    (let* ((p #p"jar:jar:file:a/foo/baz.jar!/b/c/foo.abcl!/armed/bear/bar-1.cls")
     
    371355  (:absolute "armed" "bear") "bar-1" "cls")
    372356
    373 #+(or) ;;; FIXME 'Nested Jar URLs are not supported' regression from abcl-1.5.0
    374357(deftest jar-pathname.6
    375358    (let* ((p #p"jar:http://example.org/abcl.jar!/org/armedbear/lisp/Version.class")
     
    383366  (:absolute "org" "armedbear" "lisp") "Version" "class")
    384367
    385 #+(or) ;;; FIXME 'Nested Jar URLs are not supported' regression from abcl-1.5.0
    386368(deftest jar-pathname.7
    387369    (let* ((p #p"jar:jar:http://example.org/abcl.jar!/foo.abcl!/foo-1.cls")
     
    415397  (:absolute "c" "d") "foo" "lisp")
    416398
    417 ;;; 'jar:file:' forms must be URI encoded, meaning whitespace is not allowed
     399;;; 'jar:file:' forms currently (abcl-1.8.0) can't be URI encoded, meaning whitespace is not allowed
    418400(deftest jar-pathname.10
    419401    (signals-error
     
    424406  t)
    425407
     408#+(or) ;; URI escaping not returned
    426409(deftest jar-pathname.11
    427410    (let ((s (string-downcase "jar:file:///foo/bar/a%20space%3f/that!/this")))
Note: See TracChangeset for help on using the changeset viewer.