directory.lsp 1.78 KB
Newer Older
1 2 3 4 5
;-*- Mode:     Lisp -*-
;;;; Author:   Paul Dietz
;;;; Created:  Thu Jan  1 12:00:18 2004
;;;; Contains: Tests of DIRECTORY

6

7 8

(deftest directory.1
9
  (directory "nonexistent")
10 11 12
  nil)

(deftest directory.2
13
  (directory #p"nonexistent")
14 15 16
  nil)

(deftest directory.3
17
  (directory "nonexistent" :allow-other-keys nil)
18 19 20
  nil)

(deftest directory.4
21
  (directory "nonexistent" :allow-other-keys t :foo 'bar)
22 23 24
  nil)

(deftest directory.5
25
  (directory "nonexistent" :foo 0 :allow-other-keys t)
26 27 28 29
  nil)

(deftest directory.6
  (let* ((pattern-pathname (make-pathname :name :wild :type :wild
sds's avatar
sds committed
30 31
                                          :defaults *default-pathname-defaults*))
         (pathnames (directory pattern-pathname)))
32 33 34
    (values
     (remove-if #'pathnamep pathnames)
     (loop for pn in pathnames
sds's avatar
sds committed
35 36
           unless (equal pn (truename pn))
           collect pn)
37
;;     (loop for pn in pathnames
sds's avatar
sds committed
38 39
;;         unless (pathname-match-p pn pattern-pathname)
;;         collect pn))
40
     ))
41 42 43 44 45
  nil nil ;; nil
  )

(deftest directory.7
  (let* ((pattern-pathname (make-pathname :name :wild :type :wild
sds's avatar
sds committed
46 47
                                          :defaults *default-pathname-defaults*))
         (pathnames (directory pattern-pathname)))
48
    (loop for pn in pathnames
sds's avatar
sds committed
49 50
          unless (equal pn (probe-file pn))
          collect pn))
51 52 53
  nil)

(deftest directory.8
Daniel Kochmański's avatar
Daniel Kochmański committed
54 55 56 57 58
    ;; what does this test do? Checks if we have >= then 30 files?
    ;; seems bogus to me -- jd
    (let* ((pathname-pattern "CLTEST:*.*")
           (len (length (directory pathname-pattern))))
      (if (< len 30) len nil))
59
  nil)
60

61 62 63 64
;;; Specialized string tests

(deftest directory.9
  (do-special-strings
65
   (s "nonexistent" nil)
66 67 68 69 70
   (assert (null (directory s))))
  nil)

;;; Error tests

71
(deftest directory.error.1
72 73
  (signals-error (directory) program-error)
  t)