source: trunk/source/tests/ansi-tests/wild-pathname-p.lsp @ 8991

Last change on this file since 8991 was 8991, checked in by gz, 12 years ago

Check in the gcl ansi test suite (original, in preparation for making local changes)

File size: 5.4 KB
Line 
1;-*- Mode:     Lisp -*-
2;;;; Author:   Paul Dietz
3;;;; Created:  Wed Dec 31 16:54:55 2003
4;;;; Contains: Tests of WILD-PATHNAME-P
5
6(in-package :cl-test)
7
8(compile-and-load "pathnames-aux.lsp")
9
10(deftest wild-pathname-p.1
11  (wild-pathname-p (make-pathname))
12  nil)
13
14(deftest wild-pathname-p.2
15  (loop for key in '(:host :device :directory :name :type :version nil)
16        when (wild-pathname-p (make-pathname) key)
17        collect key)
18  nil)
19
20(deftest wild-pathname-p.3
21  (let ((p (make-pathname :directory :wild)))
22    (notnot-mv (wild-pathname-p p)))
23  t)
24
25(deftest wild-pathname-p.4
26  (let ((p (make-pathname :directory :wild)))
27    (notnot-mv (wild-pathname-p p nil)))
28  t)
29
30(deftest wild-pathname-p.5
31  (let ((p (make-pathname :directory :wild)))
32    (notnot-mv (wild-pathname-p p :directory)))
33  t)
34
35(deftest wild-pathname-p.6
36  (let ((p (make-pathname :directory :wild)))
37    (loop for key in '(:host :device :name :type :version)
38        when (wild-pathname-p p key)
39        collect key))
40  nil)
41
42
43(deftest wild-pathname-p.7
44  (let ((p (make-pathname :directory '(:absolute :wild))))
45    (notnot-mv (wild-pathname-p p)))
46  t)
47
48(deftest wild-pathname-p.8
49  (let ((p (make-pathname :directory '(:absolute :wild))))
50    (notnot-mv (wild-pathname-p p nil)))
51  t)
52
53(deftest wild-pathname-p.9
54  (let ((p (make-pathname :directory '(:absolute :wild))))
55    (notnot-mv (wild-pathname-p p :directory)))
56  t)
57
58(deftest wild-pathname-p.10
59  (let ((p (make-pathname :directory '(:absolute :wild))))
60    (loop for key in '(:host :device :name :type :version)
61        when (wild-pathname-p p key)
62        collect key))
63  nil)
64
65
66(deftest wild-pathname-p.11
67  (let ((p (make-pathname :directory '(:relative :wild))))
68    (notnot-mv (wild-pathname-p p)))
69  t)
70
71(deftest wild-pathname-p.12
72  (let ((p (make-pathname :directory '(:relative :wild))))
73    (notnot-mv (wild-pathname-p p nil)))
74  t)
75
76(deftest wild-pathname-p.13
77  (let ((p (make-pathname :directory '(:relative :wild))))
78    (notnot-mv (wild-pathname-p p :directory)))
79  t)
80
81(deftest wild-pathname-p.14
82  (let ((p (make-pathname :directory '(:relative :wild))))
83    (loop for key in '(:host :device :name :type :version)
84        when (wild-pathname-p p key)
85        collect key))
86  nil)
87
88;;;
89
90(deftest wild-pathname-p.15
91  (let ((p (make-pathname :name :wild)))
92    (notnot-mv (wild-pathname-p p)))
93  t)
94
95(deftest wild-pathname-p.16
96  (let ((p (make-pathname :name :wild)))
97    (notnot-mv (wild-pathname-p p nil)))
98  t)
99
100(deftest wild-pathname-p.17
101  (let ((p (make-pathname :name :wild)))
102    (notnot-mv (wild-pathname-p p :name)))
103  t)
104
105(deftest wild-pathname-p.18
106  (let ((p (make-pathname :name :wild)))
107    (loop for key in '(:host :device :directory :type :version)
108        when (wild-pathname-p p key)
109        collect key))
110  nil)
111
112;;;   
113 
114(deftest wild-pathname-p.19
115  (let ((p (make-pathname :type :wild)))
116    (notnot-mv (wild-pathname-p p)))
117  t)
118
119(deftest wild-pathname-p.20
120  (let ((p (make-pathname :type :wild)))
121    (notnot-mv (wild-pathname-p p nil)))
122  t)
123
124(deftest wild-pathname-p.21
125  (let ((p (make-pathname :type :wild)))
126    (notnot-mv (wild-pathname-p p :type)))
127  t)
128
129(deftest wild-pathname-p.22
130  (let ((p (make-pathname :type :wild)))
131    (loop for key in '(:host :device :directory :name :version)
132        when (wild-pathname-p p key)
133        collect key))
134  nil)
135
136;;;
137
138 (deftest wild-pathname-p.23
139  (let ((p (make-pathname :version :wild)))
140    (notnot-mv (wild-pathname-p p)))
141  t)
142
143(deftest wild-pathname-p.24
144  (let ((p (make-pathname :version :wild)))
145    (notnot-mv (wild-pathname-p p nil)))
146  t)
147
148(deftest wild-pathname-p.25
149  (let ((p (make-pathname :version :wild)))
150    (notnot-mv (wild-pathname-p p :version)))
151  t)
152
153(deftest wild-pathname-p.26
154  (let ((p (make-pathname :version :wild)))
155    (loop for key in '(:host :device :directory :name :type)
156        when (wild-pathname-p p key)
157        collect key))
158  nil)
159
160;;;
161
162(deftest wild-pathname-p.27
163  (loop for p in (append *pathnames* *logical-pathnames*)
164        unless (if (wild-pathname-p p) (wild-pathname-p p nil)
165                 (not (wild-pathname-p p nil)))
166        collect p)
167  nil)
168
169(deftest wild-pathname-p.28
170  (loop for p in (append *pathnames* *logical-pathnames*)
171        when (and (loop for key in '(:host :device :directory
172                                           :name :type :version)
173                        thereis (wild-pathname-p p key))
174                  (not (wild-pathname-p p)))
175        collect p)
176  nil)
177
178;;; On streams associated with files
179
180(deftest wild-pathname-p.29
181  (with-open-file (s "foo.lsp"
182                     :direction :output
183                     :if-exists :append
184                     :if-does-not-exist :create)
185                  (wild-pathname-p s))
186  nil)
187
188(deftest wild-pathname-p.30
189  (let ((s (open "foo.lsp"
190                 :direction :output
191                 :if-exists :append
192                 :if-does-not-exist :create)))
193    (close s)
194    (wild-pathname-p s))
195  nil)
196
197;;; logical pathname designators
198
199(deftest wild-pathname-p.31
200  (wild-pathname-p "CLTEST:FOO.LISP")
201  nil)
202
203;;; Odd strings
204
205(deftest wild-pathname-p.32
206  (do-special-strings
207   (s "CLTEST:FOO.LISP" nil)
208   (let ((vals (multiple-value-list (wild-pathname-p s))))
209     (assert (equal vals '(nil)))))
210  nil)
211
212;;;
213
214(deftest wild-pathname-p.error.1
215  (signals-error (wild-pathname-p) program-error)
216  t)
217
218(deftest wild-pathname-p.error.2
219  (signals-error (wild-pathname-p *default-pathname-defaults* nil nil)
220                 program-error)
221  t)
222
223(deftest wild-pathname-p.error.3
224  (check-type-error #'wild-pathname-p
225                    (typef '(or pathname string file-stream
226                                synonym-stream)))
227  nil)
228
229(deftest wild-pathname-p.error.4
230  (check-type-error #'(lambda (x) (declare (optimize (safety 0)))
231                        (wild-pathname-p x))
232                    (typef '(or pathname string file-stream
233                                synonym-stream)))
234  nil)
Note: See TracBrowser for help on using the repository browser.