Changeset 15399
- Timestamp:
- 10/10/20 21:43:35 (3 years ago)
- Location:
- trunk/abcl/test/lisp/abcl
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/abcl/test/lisp/abcl/jar-pathname.lisp
r15397 r15399 1 (in-package #:abcl .test.lisp)1 (in-package #:abcl/test/lisp) 2 2 3 3 (defparameter *tmp-directory* nil) … … 48 48 (pathname-directory (pathname temp-file)) 49 49 '("jar-pathname-tests"))))) 50 (jar-file-init temp- file temp-dir)))51 52 (defun jar-file-init (temp- file temp-dir)50 (jar-file-init temp-dir))) 51 52 (defun jar-file-init (temp-dir) 53 53 "Create the jar archives used for testing. 54 54 Returns the two values of the pathnames of the created archives." … … 119 119 (unless (and *tmp-jar-path* (probe-file *tmp-jar-path*)) 120 120 (create-jar)) 121 (let ((*default-pathname-defaults* *tmp-directory*)) 121 (let ((*default-pathname-defaults* *tmp-directory*)) ;; why do we need this? 122 122 ,@body))) 123 123 124 (defun jar-pathname-escaped (jar path) 125 (pathname (format nil "jar:file:~A!/~A" 126 (ext:uri-encode (namestring jar)) path))) 127 128 (defmacro load-from-jar (jar path) 129 `(with-jar-file-init 130 (load (jar-pathname-escaped ,jar ,path)))) 131 132 ;;; XXX Figure out correct use of macros so this isn't necessary 133 #| 134 (push 'jar-pathname.load.init *expected-failures*) 135 (deftest jar-pathname.load.init 136 (with-jar-file-init 137 nil) 138 t) 139 |# 124 (defun load-from-jar (jar entry) 125 (let ((jar-pathname (if (ext:pathname-jar-p jar) 126 jar 127 (make-pathname :device (list jar))))) 128 (load (merge-pathnames entry jar-pathname)))) 140 129 141 130 (deftest jar-pathname.load.1 142 (load-from-jar *tmp-jar-path* "__loader__._") 143 t) 144 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*) 145 137 (deftest jar-pathname.load.2 146 (load-from-jar *tmp-jar-path* "bar") 147 t) 148 138 (with-jar-file-init 139 (load-from-jar *tmp-jar-path* "bar")) 140 t) 141 142 ;; Needs nested jars implementation 143 (pushnew 'jar-pathname.load.3 *expected-failures*) 149 144 (deftest jar-pathname.load.3 150 (load-from-jar *tmp-jar-path* "bar.abcl") 145 (with-jar-file-init 146 (load-from-jar *tmp-jar-path* "bar.abcl")) 151 147 t) 152 148 153 149 (deftest jar-pathname.load.4 154 (load-from-jar *tmp-jar-path* "eek") 150 (with-jar-file-init 151 (load-from-jar *tmp-jar-path* "eek")) 155 152 t) 156 153 157 154 (deftest jar-pathname.load.5 158 (load-from-jar *tmp-jar-path* "eek.lisp")159 t)160 161 #+(or) 155 (with-jar-file-init 156 (load-from-jar *tmp-jar-path* "eek.lisp")) 157 t) 158 162 159 (deftest jar-pathname.load.6 163 (load-from-jar *tmp-jar-path* "foo") 164 t) 165 160 (signals-error 161 (load-from-jar *tmp-jar-path* "this doesn't exist") 162 'file-error) 163 t) 164 165 ;; Needs nested jars implementation 166 (pushnew 'jar-pathname.load.7 *expected-failures*) 166 167 (deftest jar-pathname.load.7 167 (load-from-jar *tmp-jar-path* "a/b/bar") 168 t) 169 168 (with-jar-file-init 169 (load-from-jar *tmp-jar-path* "a/b/bar")) 170 t) 171 172 ;; Needs nested jars implementation 173 (pushnew 'jar-pathname.load.8 *expected-failures*) 170 174 (deftest jar-pathname.load.8 171 (load-from-jar *tmp-jar-path* "a/b/bar.abcl") 175 (with-jar-file-init 176 (load-from-jar *tmp-jar-path* "a/b/bar.abcl")) 172 177 t) 173 178 174 179 (deftest jar-pathname.load.9 175 (load-from-jar *tmp-jar-path* "a/b/eek") 180 (with-jar-file-init 181 (load-from-jar *tmp-jar-path* "a/b/eek")) 176 182 t) 177 183 178 184 (deftest jar-pathname.load.10 179 (load-from-jar *tmp-jar-path* "a/b/eek.lisp") 180 t) 181 185 (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*) 182 191 (deftest jar-pathname.load.11 183 (load-from-jar *tmp-jar-path* "d/e+f/bar.abcl") 184 t) 185 192 (with-jar-file-init 193 (load-from-jar *tmp-jar-path* "d/e+f/bar.abcl")) 194 t) 195 196 ;; Needs nested jars implementation 197 (pushnew 'jar-pathname.load.12 *expected-failures*) 186 198 (deftest jar-pathname.load.12 187 (load-from-jar *tmp-jar-path* "a/b/foo%20bar.abcl") 188 t) 189 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*) 190 205 (deftest jar-pathname.load.13 191 192 193 206 (signals-error 207 (load-from-jar *tmp-jar-path* "a/b/foo bar.abcl") 208 'error) 194 209 t) 195 210 … … 199 214 200 215 (deftest jar-pathname.load.15 201 (signals-error 202 (load-from-jar *tmp-jar-path-whitespace* "a/b/foo bar.abcl") 203 'error) 204 t) 205 216 (signals-error 217 (load-from-jar *tmp-jar-path-whitespace* "a/b/foo bar.abcl") 218 'error) 219 t) 220 221 ;; Needs nested jars implementation 222 (pushnew 'jar-pathname.load.16 *expected-failures*) 206 223 (deftest jar-pathname.load.16 207 224 (load-from-jar *tmp-jar-path-whitespace* "a/b/foo%20bar.abcl") … … 209 226 210 227 (defparameter *url-jar-pathname-base* 211 "jar:https://abcl.org/releases/1.7.1/abcl-bin-1.7.1.zip!/")228 #p"jar:https://abcl.org/releases/1.7.1/abcl-contrib.jar!/") 212 229 213 230 (deftest jar-pathname.url.https.1 214 (probe-file *url-jar-pathname-base*) 215 *url-jar-pathname-base*) 231 (equalp 232 *url-jar-pathname-base* 233 (probe-file *url-jar-pathname-base*)) 234 t) 216 235 217 236 (deftest jar-pathname.probe-file.1 218 (let ((result 219 (with-jar-file-init 220 (probe-file "jar:file:baz.jar!/eek.lisp")))) 221 (string= 222 (if result (namestring result) "") 223 (format nil "jar:file:~Abaz.jar!/eek.lisp" 224 (namestring *tmp-directory*)))) 237 (with-jar-file-init 238 (let ((p 239 (merge-pathnames "eek.lisp" 240 (make-pathname :device (list *tmp-jar-path*))))) 241 (not (null (probe-file p))))) 225 242 t) 226 243 227 244 (deftest jar-pathname.probe-file.2 228 (let ((result 229 (with-jar-file-init 230 (probe-file "jar:file:baz.jar!/a/b/bar.abcl")))) 231 (string= 232 (if result (namestring result) "") 233 (format nil "jar:file:~Abaz.jar!/a/b/bar.abcl" 234 (namestring *tmp-directory*)))) 235 t) 236 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 237 253 (deftest jar-pathname.probe-file.3 238 254 (let ((result … … 245 261 t) 246 262 247 248 (push 'jar-pathname.probe-file.4 *expected-failures*)249 263 (deftest jar-pathname.probe-file.4 250 (let ((result 251 (with-jar-file-init 252 (probe-file "jar:file:baz.jar!/a/b")))) 253 (string= 254 (if result (namestring result) "") 255 (format nil "jar:file:~Abaz.jar!/a/b/" 256 (namestring *tmp-directory*)))) 257 t) 258 259 (push 'jar-pathname.probe-file.5 *expected-failures*) 264 (with-jar-file-init 265 (let ((p 266 (merge-pathnames "a/b/bar.abcl" 267 (make-pathname :device (list *tmp-jar-path*))))) 268 (not (null (probe-file p))))) 269 t) 270 260 271 (deftest jar-pathname.probe-file.5 261 (let ((result 262 (with-jar-file-init 263 (probe-file "jar:file:baz.jar!/a/b/")))) 264 (string= 265 (if result (namestring result) "") 266 (format nil "jar:file:~Abaz.jar!/a/b/" 267 (namestring *tmp-directory*)))) 272 (with-jar-file-init 273 (let ((p 274 (merge-pathnames "a/b/" 275 (make-pathname :device (list *tmp-jar-path*))))) 276 (not (null (probe-file p))))) 268 277 t) 269 278 270 279 271 280 (deftest jar-pathname.probe-file.6 272 (let ((result 273 (with-jar-file-init 274 (probe-file "jar:file:baz.jar!/d/e+f/bar.abcl")))) 275 (string= 276 (if result (namestring result) "") 277 (format nil "jar:file:~Abaz.jar!/d/e+f/bar.abcl" 278 (namestring *tmp-directory*)))) 279 t) 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 280 288 281 289 (deftest jar-pathname.merge-pathnames.1 282 283 "/bar.abcl" #p"jar:file:baz.jar!/foo")284 #p"jar:file: baz.jar!/bar.abcl")290 (merge-pathnames 291 "/bar.abcl" #p"jar:file:/baz.jar!/foo") 292 #p"jar:file:/baz.jar!/bar.abcl") 285 293 286 294 (deftest jar-pathname.merge-pathnames.2 287 288 "bar.abcl" #p"jar:file:baz.jar!/foo/baz")289 #p"jar:file: baz.jar!/foo/bar.abcl")295 (merge-pathnames 296 "bar.abcl" #p"jar:file:/baz.jar!/foo/baz") 297 #p"jar:file:/baz.jar!/foo/bar.abcl") 290 298 291 299 (deftest jar-pathname.merge-pathnames.3 292 300 (merge-pathnames 293 "jar:file: baz.jar!/foo" "bar")294 #p"jar:file: baz.jar!/foo")301 "jar:file:/baz.jar!/foo" "bar") 302 #p"jar:file:/baz.jar!/foo") 295 303 296 304 (deftest jar-pathname.merge-pathnames.4 297 305 (merge-pathnames 298 "jar:file: baz.jar!/foo" "/a/b/c")306 "jar:file:/baz.jar!/foo" "/a/b/c") 299 307 #p"jar:file:/a/b/baz.jar!/foo") 300 301 308 302 309 ;;; Under win32, we get the device in the merged path 303 310 #+windows 304 311 (push 'jar-pathname.merge-pathnames.5 *expected-failures*) 305 306 312 (deftest jar-pathname.merge-pathnames.5 307 313 (merge-pathnames "jar:file:/a/b/c/foo.jar!/bar/baz.lisp") 308 314 #p"jar:file:/a/b/c/foo.jar!/bar/baz.lisp") 309 315 310 316 (deftest jar-pathname.truename.1 311 312 317 (signals-error (truename "jar:file:baz.jar!/foo") 318 'file-error) 313 319 t) 314 320 315 321 (deftest jar-pathname.1 316 (let* ((p #p"jar:file: foo/baz.jar!/")322 (let* ((p #p"jar:file:/foo/baz.jar!/") 317 323 (d (first (pathname-device p)))) 318 324 (values 319 325 (pathname-directory d) (pathname-name d) (pathname-type d))) 320 (: relative "foo") "baz" "jar")326 (:absolute "foo") "baz" "jar") 321 327 322 328 (deftest jar-pathname.2 … … 419 425 420 426 (deftest jar-pathname.11 421 (let ((s (string-downcase "jar:file:/ foo/bar/a%20space%3f/that!/this")))427 (let ((s (string-downcase "jar:file:///foo/bar/a%20space%3f/that!/this"))) 422 428 (string= s 423 429 (string-downcase (namestring (pathname s))))) -
trunk/abcl/test/lisp/abcl/package.lisp
r15332 r15399 1 (defpackage #:abcl .test.lisp1 (defpackage #:abcl/test/lisp 2 2 (:use #:cl #:abcl-rt) 3 (:nicknames "ABCL-TEST-LISP" "ABCL-TEST" "ABCL/TEST/LISP")3 (:nicknames #:abcl-test-lisp #:abcl-test #:abcl.test.lisp) 4 4 (:export 5 5 #:run
Note: See TracChangeset
for help on using the changeset viewer.