[armedbear-cvs] r13313 - trunk/abcl/test/lisp/abcl
mevenson at common-lisp.net
mevenson at common-lisp.net
Wed Jun 8 16:03:16 UTC 2011
Author: mevenson
Date: Wed Jun 8 09:03:16 2011
New Revision: 13313
Log:
Use directory derived from java.io.File.createTempFile() to write tests.
*TMP-DIRECTORY* now names the location used by the JAR-PATHNAME tests
to create and load tests.
Move the forms to compile into special variables.
Deleted:
trunk/abcl/test/lisp/abcl/bar.lisp
trunk/abcl/test/lisp/abcl/eek.lisp
trunk/abcl/test/lisp/abcl/foo.lisp
Modified:
trunk/abcl/test/lisp/abcl/jar-pathname.lisp
Modified: trunk/abcl/test/lisp/abcl/jar-pathname.lisp
==============================================================================
--- trunk/abcl/test/lisp/abcl/jar-pathname.lisp Wed Jun 8 08:28:11 2011 (r13312)
+++ trunk/abcl/test/lisp/abcl/jar-pathname.lisp Wed Jun 8 09:03:16 2011 (r13313)
@@ -2,13 +2,64 @@
(defvar *jar-file-init* nil)
+(defparameter *tmp-directory*
+ (make-pathname
+ :directory (append
+ (pathname-directory (pathname
+ (java:jcall "getAbsolutePath"
+ (java:jstatic "createTempFile" "java.io.File"
+ "jar" "tmp"))))
+ '("jar-pathname-tests"))))
+
+
+(defvar *foo.lisp*
+ `((defun foo ()
+ (labels ((output ()
+ (format t "FOO here.")))
+ (output)))))
+
+(defvar *bar.lisp*
+ `((defvar *pathname* *load-pathname*)
+ (defvar *truename* *load-truename*)
+
+ (defun bar ()
+ (labels
+ ((output ()
+ (format t "Some BAR~%*load-pathname* ~S~%*load-truename* ~S~%"
+ *pathname* *truename*)))
+ (output)))
+ (defvar *bar* t)
+
+ (defun baz ()
+ (format t "Some BAZ"))))
+
+(defvar *eek.lisp*
+ `((defun eek ()
+ (format t "Another EEK."))
+ (defun ook ()
+ (let ((*load-verbose* t))
+ (load (merge-pathnames #p"bar" *load-truename*))))
+ (defun aak ()
+ (format t "*LOAD-TRUENAME* is '~A'" *load-truename*))))
+
+(defun write-forms (forms path)
+ (with-open-file (s path :direction :output :if-exists :supersede)
+ (with-standard-io-syntax
+ (dolist (form forms)
+ (print form s)))))
+
(defun jar-file-init ()
- (let* ((*default-pathname-defaults* *abcl-test-directory*)
+ (format t "~&Using ~A to create files for testing jar-pathnames.~%" *tmp-directory*)
+ (ensure-directories-exist *tmp-directory*)
+ (let* ((*default-pathname-defaults* *tmp-directory*)
(asdf::*verbose-out* *standard-output*))
+ (write-forms *foo.lisp* "foo.lisp")
(compile-file "foo.lisp")
+ (write-forms *bar.lisp* "bar.lisp")
(compile-file "bar.lisp")
+ (write-forms *eek.lisp* "eek.lisp")
(compile-file "eek.lisp")
- (let* ((tmpdir (merge-pathnames "tmp/" *abcl-test-directory*))
+ (let* ((tmpdir (merge-pathnames "tmp/" *tmp-directory*))
(subdirs
(mapcar (lambda (p) (merge-pathnames p tmpdir))
'("a/b/" "d/e+f/")))
@@ -37,7 +88,7 @@
(setf *jar-file-init* t))
(defmacro with-jar-file-init (&rest body)
- `(let ((*default-pathname-defaults* *abcl-test-directory*))
+ `(let ((*default-pathname-defaults* *tmp-directory*))
(progn
(unless *jar-file-init*
(jar-file-init))
@@ -158,33 +209,33 @@
(with-jar-file-init
(probe-file "jar:file:baz.jar!/a/b/bar.abcl"))
#p#.(format nil "jar:file:~A/baz.jar!/a/b/bar.abcl"
- (namestring *abcl-test-directory*)))
+ (namestring *tmp-directory*)))
(deftest jar-pathname.probe-file.3
(with-jar-file-init
(probe-file "jar:jar:file:baz.jar!/a/b/bar.abcl!/bar._"))
#p#.(format nil "jar:jar:file:~Abaz.jar!/a/b/bar.abcl!/bar._"
- (namestring *abcl-test-directory*)))
+ (namestring *tmp-directory*)))
(push 'jar-pathname.probe-file.4 *expected-failures*)
(deftest jar-pathname.probe-file.4
(with-jar-file-init
(probe-file "jar:file:baz.jar!/a/b"))
#p#.(format nil "jar:file:~Abaz.jar!/a/b/"
- (namestring *abcl-test-directory*)))
+ (namestring *tmp-directory*)))
(push 'jar-pathname.probe-file.5 *expected-failures*)
(deftest jar-pathname.probe-file.5
(with-jar-file-init
(probe-file "jar:file:baz.jar!/a/b/"))
#p#.(format nil "jar:file:~Abaz.jar!/a/b/"
- (namestring *abcl-test-directory*)))
+ (namestring *tmp-directory*)))
(deftest jar-pathname.probe-file.6
(with-jar-file-init
(probe-file "jar:file:baz.jar!/d/e+f/bar.abcl"))
#p#.(format nil "jar:file:~Abaz.jar!/d/e+f/bar.abcl"
- (namestring *abcl-test-directory*)))
+ (namestring *tmp-directory*)))
(deftest jar-pathname.merge-pathnames.1
(merge-pathnames
More information about the armedbear-cvs
mailing list