source: trunk/source/tests/ansi-tests/file-error.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.5 KB
Line 
1;-*- Mode:     Lisp -*-
2;;;; Author:   Paul Dietz
3;;;; Created:  Tue Jan 13 19:10:02 2004
4;;;; Contains: Tests of the FILE-ERROR condition, and associated accessor function
5
6(in-package :cl-test)
7
8(deftest file-error.1
9  (let ((pn (make-pathname :name :wild
10                           :type "txt"
11                           :version :newest
12                           :defaults *default-pathname-defaults*)))
13    (handler-case
14     (probe-file pn)
15     (error (c)
16            (values
17             (notnot (typep c 'file-error))
18             (if (equalp (file-error-pathname c) pn)
19                 t
20               (list (file-error-pathname c) pn))))))
21  t t)
22
23(deftest file-error-pathname.1
24  (let ((c (make-condition 'file-error :pathname "foo.txt")))
25    (values
26     (notnot (typep c 'file-error))
27     (eqlt (class-of c) (find-class 'file-error))
28     (file-error-pathname c)))
29  t t "foo.txt")
30
31(deftest file-error-pathname.2
32  (let ((c (make-condition 'file-error :pathname #p"foo.txt")))
33    (values
34     (notnot (typep c 'file-error))
35     (eqlt (class-of c) (find-class 'file-error))
36     (equalt #p"foo.txt" (file-error-pathname c))))
37  t t t)
38
39(deftest file-error-pathname.3
40  (let ((c (make-condition 'file-error :pathname "CLTEST:foo.txt")))
41    (values
42     (notnot (typep c 'file-error))
43     (eqlt (class-of c) (find-class 'file-error))
44     (equalpt "CLTEST:foo.txt"
45              (file-error-pathname c))))
46  t t t)
47
48(deftest file-error-pathname.4
49  (let ((c (make-condition 'file-error :pathname (logical-pathname "CLTEST:foo.txt"))))
50    (values
51     (notnot (typep c 'file-error))
52     (eqlt (class-of c) (find-class 'file-error))
53     (equalpt (logical-pathname "CLTEST:foo.txt")
54              (file-error-pathname c))))
55  t t t)
56
57(deftest file-error-pathname.5
58  (with-open-file (s "file-error.lsp" :direction :input)
59                  (let ((c (make-condition 'file-error :pathname s)))
60                    (values
61                     (notnot (typep c 'file-error))
62                     (eqlt (class-of c) (find-class 'file-error))
63                     (equalpt s (file-error-pathname c)))))
64  t t t)
65
66(deftest file-error-pathname.6
67  (let ((s (open "file-error.lsp" :direction :input)))
68    (close s)
69    (let ((c (make-condition 'file-error :pathname s)))
70      (values
71       (notnot (typep c 'file-error))
72       (eqlt (class-of c) (find-class 'file-error))
73       (equalpt s (file-error-pathname c)))))
74  t t t)
75
76(deftest file-error-pathname.error.1
77  (signals-error (file-error-pathname) program-error)
78  t)
79
80(deftest file-error-pathname.error.2
81  (signals-error
82   (file-error-pathname (make-condition 'file-error :pathname "foo.txt") nil)
83   program-error)
84  t)
85
86
87
88
89
Note: See TracBrowser for help on using the repository browser.