Changeset 10040


Ignore:
Timestamp:
09/26/05 12:21:37 (16 years ago)
Author:
piso
Message:

ENSURE-DIRECTORIES-EXIST.1

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/j/src/org/armedbear/lisp/tests/file-system-tests.lisp

    r10039 r10040  
    2222;;   (setf (logical-pathname-translations "ansi-tests")
    2323;;         '(("*.*.*" "/home/peter/gcl/ansi-tests/*.*")))
     24
     25#+:sbcl (require '#:sb-posix)
    2426
    2527(unless (member "RT" *modules* :test #'string=)
     
    249251(pushnew 'symlink.2 *expected-failures*)
    250252
     253(deftest ensure-directories-exist.1
     254  (let* ((tmp (make-temporary-filename *this-directory*))
     255         (directory-namestring (concatenate 'string (namestring tmp) "/"))
     256         (file-namestring (concatenate 'string directory-namestring "foo.bar")))
     257    (multiple-value-bind (path created)
     258        (ensure-directories-exist file-namestring)
     259      (values
     260       ;; 1. "The primary value is the given pathspec..."
     261       #+(or allegro clisp)
     262       (eq path file-namestring)
     263       #-(or allegro clisp)
     264       (pathnames-equal-p (pathname path) (pathname file-namestring))
     265       ;; 2. Verify that the directory was created.
     266       created
     267       ;; 3. Verify that the directory exists.
     268       #+clisp
     269       ;; CLISP's PROBE-DIRECTORY just returns T.
     270       (ext:probe-directory directory-namestring)
     271       #-clisp
     272       (pathnames-equal-p (probe-file directory-namestring)
     273                          (pathname directory-namestring))
     274       ;; 4. Delete the directory.
     275       #+allegro
     276       (when (excl:probe-directory directory-namestring)
     277         (excl:delete-directory directory-namestring))
     278       #+clisp
     279       (when (ext:probe-directory directory-namestring)
     280         (ext:delete-dir directory-namestring))
     281       #-(or allegro clisp)
     282       (when (probe-file directory-namestring)
     283         #-(or cmu sbcl) (delete-file directory-namestring)
     284         #+cmu (unix:unix-rmdir directory-namestring)
     285         #+sbcl (zerop (sb-posix:rmdir directory-namestring)))
     286       ;; 5. Verify that it's no longer there.
     287       #-clisp
     288       (probe-file directory-namestring)
     289       #+clisp
     290       (ext:probe-directory directory-namestring))))
     291  t t t t nil)
     292
    251293(do-tests)
Note: See TracChangeset for help on using the changeset viewer.