Changeset 10070


Ignore:
Timestamp:
09/30/05 18:18:24 (16 years ago)
Author:
piso
Message:

Work in progress.

File:
1 edited

Legend:

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

    r10064 r10070  
    180180  #+sbcl (probe-file pathname) ; FIXME
    181181  )
     182
     183(defun make-directory (pathname)
     184  #+allegro (excl:make-directory pathname)
     185  #-allegro
     186  (let ((namestring (directory-namestring pathname))
     187        )
     188    ))
    182189
    183190(defun delete-directory (pathname)
     
    309316#+allegro
    310317(pushnew 'symlink.2 *expected-failures*)
     318
     319;; user-homedir-pathname &optional host => pathname
     320
     321;; "USER-HOMEDIR-PATHNAME returns a pathname without any name, type, or version
     322;; component (those components are all nil) for the user's home directory on
     323;; HOST. If it is impossible to determine the user's home directory on HOST,
     324;; then nil is returned. USER-HOMEDIR-PATHNAME never returns nil if HOST is not
     325;; supplied."
     326(deftest user-homedir-pathname.1
     327  (let ((pathname (user-homedir-pathname)))
     328    (values (pathnamep pathname)
     329            (pathname-name pathname)
     330            (pathname-type pathname)
     331            (pathname-version pathname)))
     332  t nil nil nil)
     333#+allegro
     334;; Allegro's version component is :UNSPECIFIC.
     335(pushnew 'user-homedir-pathname.1 *expected-failures*)
     336
     337(deftest directory-namestring.1
     338  (let ((pathname (user-homedir-pathname)))
     339    (equal (namestring pathname) (directory-namestring pathname)))
     340  t)
    311341
    312342(deftest ensure-directories-exist.1
     
    339369  t t t t nil)
    340370
     371;; What happens if you call ENSURE-DIRECTORIES-EXIST with a pathname that has
     372;; no name, type, or version component?
     373
     374;; Case 1: the directory in question already exists.
     375(deftest ensure-directories-exist.2
     376  (let ((pathname
     377         (make-pathname :host (pathname-host *this-directory*)
     378                        :device (pathname-device *this-directory*)
     379                        :directory (pathname-directory *this-directory*)
     380                        :name nil :type nil :version nil)))
     381    (multiple-value-bind (path created)
     382        (ensure-directories-exist pathname)
     383      (values
     384       #+(or allegro clisp)
     385       (eq path pathname)
     386       #-(or allegro clisp)
     387       (pathnames-equal-p (pathname path) (pathname pathname))
     388       created)))
     389  t nil)
     390
     391(deftest ensure-directories-exist.3
     392  (let* ((tmp (make-temporary-filename *this-directory*))
     393         (directory-namestring (concatenate 'string (namestring tmp) "/"))
     394         (pathname (pathname directory-namestring)))
     395    (multiple-value-bind (path created)
     396        (ensure-directories-exist pathname)
     397      (values
     398       #+(or allegro clisp)
     399       (eq path pathname)
     400       #-(or allegro clisp)
     401       (pathnames-equal-p (pathname path) (pathname pathname))
     402       created
     403       (not (null (probe-directory directory-namestring)))
     404       (when (probe-directory directory-namestring)
     405         (delete-directory directory-namestring))
     406       )))
     407  t t t t)
     408
    341409(do-tests)
Note: See TracChangeset for help on using the changeset viewer.