source: trunk/source/tests/ansi-tests/with-open-stream.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: 1.8 KB
Line 
1;-*- Mode:     Lisp -*-
2;;;; Author:   Paul Dietz
3;;;; Created:  Mon Dec 13 01:42:59 2004
4;;;; Contains: Tests of WITH-OPEN-STREAM
5
6(in-package :cl-test)
7
8(deftest with-open-stream.1
9  (with-open-stream (os (make-string-output-stream)))
10  nil)
11
12(deftest with-open-stream.2
13  (with-open-stream (os (make-string-output-stream))
14                    (declare (ignore os)))
15  nil)
16
17(deftest with-open-stream.3
18  (with-open-stream (os (make-string-output-stream))
19                    (declare (ignore os))
20                    (declare (type string-stream os)))
21  nil)
22
23(deftest with-open-stream.4
24  (with-open-stream (os (make-string-output-stream))
25                    (declare (ignore os))
26                    (values)))
27
28(deftest with-open-stream.5
29  (with-open-stream (os (make-string-output-stream))
30                    (declare (ignore os))
31                    (values 'a 'b))
32  a b)
33
34(deftest with-open-stream.6
35  (let ((s (make-string-output-stream)))
36    (values
37     (with-open-stream (os s))
38     (notnot (typep s 'string-stream))
39     (open-stream-p s)))
40  nil t nil)
41
42(deftest with-open-stream.7
43  (let ((s (make-string-input-stream "123")))
44    (values
45     (with-open-stream (is s) (read-char s))
46     (notnot (typep s 'string-stream))
47     (open-stream-p s)))
48  #\1 t nil)
49
50(deftest with-open-stream.8
51  (let ((s (make-string-output-stream)))
52    (values
53     (block done
54      (with-open-stream (os s) (return-from done nil)))
55     (notnot (typep s 'string-stream))
56     (open-stream-p s)))
57  nil t nil)
58
59(deftest with-open-stream.9
60  (let ((s (make-string-output-stream)))
61    (values
62     (catch 'done
63      (with-open-stream (os s) (throw 'done nil)))
64     (notnot (typep s 'string-stream))
65     (open-stream-p s)))
66  nil t nil)
67
68;;; Free declaration scope
69
70(deftest with-open-stream.10
71  (block done
72    (let ((x :bad))
73      (declare (special x))
74      (let ((x :good))
75        (with-open-stream (s (return-from done x))
76                          (declare (special x))))))
77  :good)
Note: See TracBrowser for help on using the repository browser.