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

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

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

File size: 2.3 KB
Line 
1;-*- Mode:     Lisp -*-
2;;;; Author:   Paul Dietz
3;;;; Created:  Tue Dec 30 19:05:01 2003
4;;;; Contains: Tests of LOGICAL-PATHNAME
5
6(in-package :cl-test)
7
8(deftest logical-pathname.1
9  (loop for x in *logical-pathnames*
10        always (eql x (logical-pathname x)))
11  t)
12
13(deftest logical-pathname.2
14  (notnot-mv (typep (logical-pathname "CLTEST:FOO") 'logical-pathname))
15  t)
16
17(deftest logical-pathname.3
18  (let ((name "CLTEST:TEMP.DAT.NEWEST"))
19    (with-open-file
20     (s (logical-pathname name)
21        :direction :output
22        :if-exists :supersede
23        :if-does-not-exist :create)
24     (or (equalt (logical-pathname s) (logical-pathname name))
25         (list (logical-pathname s) (logical-pathname name)))))
26  t)
27
28
29;;; Error tests
30
31(deftest logical-pathname.error.1
32  (check-type-error #'logical-pathname
33                    (typef '(or string stream logical-pathname)))
34  nil)
35
36(deftest logical-pathname.error.2
37  ;; Doesn't specify a host
38  (signals-error (logical-pathname "FOO.TXT") type-error)
39  t)
40
41(deftest logical-pathname.error.3
42  (signals-error
43   (with-open-file (s #p"logical-pathname.lsp" :direction :input)
44                   (logical-pathname s))
45   type-error)
46  t)
47
48(deftest logical-pathname.error.4
49  (signals-error
50   (with-open-stream
51    (is (make-concatenated-stream))
52    (with-open-stream
53     (os (make-broadcast-stream))
54     (with-open-stream
55      (s (make-two-way-stream is os))
56      (logical-pathname s))))
57   type-error)
58  t)
59
60(deftest logical-pathname.error.5
61  (signals-error
62   (with-open-stream
63    (is (make-concatenated-stream))
64    (with-open-stream
65     (os (make-broadcast-stream))
66     (with-open-stream
67      (s (make-echo-stream is os))
68      (logical-pathname s))))
69   type-error)
70  t)
71
72(deftest logical-pathname.error.6
73  (signals-error (with-open-stream (s (make-broadcast-stream)) (logical-pathname s)) type-error)
74  t)
75
76(deftest logical-pathname.error.7
77  (signals-error (with-open-stream (s (make-concatenated-stream)) (logical-pathname s)) type-error)
78  t)
79
80(deftest logical-pathname.error.8
81  (signals-error (with-open-stream (s (make-string-input-stream "foo"))
82                                   (logical-pathname s)) type-error)
83  t)
84
85(deftest logical-pathname.error.9
86  (signals-error (with-output-to-string (s) (logical-pathname s)) type-error)
87  t)
88
89(deftest logical-pathname.error.10
90  (handler-case
91   (progn (eval '(locally (declare (optimize safety)) (logical-pathname "CLROOT:%"))) t)
92   (type-error () t))
93  t)
Note: See TracBrowser for help on using the repository browser.