[osicat-cvs] CVS update: src/test-tools.lisp src/osicat.asd src/osicat.lisp src/test-osicat.lisp src/test-setup.lisp

Nikodemus Siivola nsiivola at common-lisp.net
Sun Feb 29 20:29:35 UTC 2004


Update of /project/osicat/cvsroot/src
In directory common-lisp.net:/tmp/cvs-serv5965

Modified Files:
	osicat.asd osicat.lisp test-osicat.lisp 
Added Files:
	test-tools.lisp 
Removed Files:
	test-setup.lisp 
Log Message:
 * Turn ENVIRONMENT into a function.
 * Fix tests, nicer test-suite.

Date: Sun Feb 29 15:29:35 2004
Author: nsiivola



Index: src/osicat.asd
diff -u src/osicat.asd:1.5 src/osicat.asd:1.6
--- src/osicat.asd:1.5	Sun Feb 29 13:10:41 2004
+++ src/osicat.asd	Sun Feb 29 15:29:35 2004
@@ -83,12 +83,15 @@
 
 (defsystem :osicat-test
     :depends-on (:osicat :rt)
-    :components ((:file "test-setup")
-		 (:file "test-osicat" :depends-on ("test-setup"))))
+    :components ((:file "test-tools")
+		 (:file "test-osicat" :depends-on ("test-tools"))))
 
 (defmethod perform ((o test-op) (c (eql (find-system :osicat))))
   (operate 'load-op :osicat-test)
-  (operate 'test-op :osicat-test :force t))
+  (funcall (intern "SETUP" :osicat-test))
+  (unwind-protect
+       (operate 'test-op :osicat-test :force t)
+    (funcall (intern "TEARDOWN" :osicat-test))))
 
 (defmethod perform ((o test-op) (c (eql (find-system :osicat-test))))
   (or (funcall (intern "DO-TESTS" :rt))


Index: src/osicat.lisp
diff -u src/osicat.lisp:1.12 src/osicat.lisp:1.13
--- src/osicat.lisp:1.12	Sun Feb 29 13:36:42 2004
+++ src/osicat.lisp	Sun Feb 29 15:29:35 2004
@@ -237,7 +237,16 @@
 	nil
 	(error "Could not remove environment variable ~S." name))))
 
-(defun get-environ ()
+(defun environment ()
+  "function ENVIRONMENT => alist
+function (SETF ENVIRONMENT) alist => alist
+
+ENVIRONMENT return the current environment as an assoc-list. 
+SETF ENVIRONMENT modifies the environment its argument. 
+
+Often it is preferable to use SETF ENVIRONMENT-VARIABLE and
+MAKUNBOUND-ENVIRONMENT-VARIABLE to modify the environment instead
+of SETF ENVIRONMENT."
   (handler-case
       (loop for i from 0 by 1
 	    for string = (convert-from-cstring
@@ -249,7 +258,7 @@
     (error (e)
       (error "Could not access environment (~S)." e))))
 
-(defun (setf get-environ) (alist)
+(defun (setf environment) (alist)
   (let ((oldenv (get-environ)))
     (loop for (var . val) in alist
 	  do (setf (environment-variable var) (string val)
@@ -260,15 +269,6 @@
 	  do (makunbound-environment-variable var)))
   alist)
 
-(define-symbol-macro environment (get-environ))
-
-(setf (documentation 'environment 'variable)
-      "symbol-macro ENVIRONMENT
-
-The current environment as a read-only assoc-list. To modify
-the environment use (SETF ENVIRONMENT-VARIABLE) and
-MAKUNBOUND-ENVIRONMENT-VARIABLE.")
-  
 (defun read-link (pathspec)
   "function READ-LINK pathspec => pathname
 


Index: src/test-osicat.lisp
diff -u src/test-osicat.lisp:1.1 src/test-osicat.lisp:1.2
--- src/test-osicat.lisp:1.1	Tue Nov 18 03:18:58 2003
+++ src/test-osicat.lisp	Sun Feb 29 15:29:35 2004
@@ -85,29 +85,40 @@
   nil)
 
 (deftest file-kind.3
-    (file-kind *test-symlink*)
+    (let* ((file (ensure-file "tmp-file"))
+	   (link (ensure-link "tmp-link" :target file)))
+      (unwind-protect
+	   (file-kind link)
+	(delete-file link)
+	(delete-file file)))
   :symbolic-link)
 
 (deftest file-kind.4
-    (file-kind *test-file*)
+    (let ((file (ensure-file "tmp-file")))
+      (unwind-protect
+	   (file-kind file)
+	(delete-file file)))
   :regular-file)
 
 (deftest make-link.1
-    (let ((link (merge-pathnames "make-link-test-link" *test-dir*)))
+    (let ((link (merge-pathnames "make-link-test-link" *test-dir*))
+	  (file (ensure-file "tmp-file")))
       (unwind-protect
 	   (progn
-	     (make-link *test-file* link)
+	     (make-link link :target file)
 	     (namestring (read-link link)))
-	(delete-file link)))
-  #.(namestring *test-file*))
+	(delete-file link)
+	(delete-file file)))
+  #.(namestring (merge-pathnames "tmp-file" *test-dir*)))
 
 (deftest make-link.2
-    (let ((link (merge-pathnames "make-link-test-link" *test-dir*)))
+    (let ((link (merge-pathnames "make-link-test-link" *test-dir*))
+	  (file (ensure-file "tmp-file")))
       (unwind-protect
 	   (progn
-	     (make-link *test-file* link)
+	     (make-link link :target file)
 	     (file-kind link))
+	(delete-file file)
 	(delete-file link)))
   :symbolic-link)
-
 	  







More information about the Osicat-cvs mailing list