source: trunk/source/tests/ansi-tests/make-string-output-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: 3.7 KB
Line 
1;-*- Mode:     Lisp -*-
2;;;; Author:   Paul Dietz
3;;;; Created:  Sat Feb 14 19:42:07 2004
4;;;; Contains: Tests of MAKE-STRING-OUTPUT-STREAM
5
6(in-package :cl-test)
7
8(deftest make-string-output-stream.1
9  (let ((s (make-string-output-stream)))
10    (values
11     (notnot (typep s 'stream))
12     (notnot (typep s 'string-stream))
13     (input-stream-p s)
14     (notnot (output-stream-p s))
15     (notnot (open-stream-p s))))
16  t t nil t t)
17
18(deftest make-string-output-stream.2
19  (let ((s (make-string-output-stream :element-type 'character)))
20    (values
21     (notnot (typep s 'stream))
22     (notnot (typep s 'string-stream))
23     (input-stream-p s)
24     (notnot (output-stream-p s))
25     (notnot (open-stream-p s))))
26  t t nil t t)
27
28(deftest make-string-output-stream.3
29  (let ((s (make-string-output-stream :element-type 'base-char)))
30    (values
31     (notnot (typep s 'stream))
32     (notnot (typep s 'string-stream))
33     (input-stream-p s)
34     (notnot (output-stream-p s))
35     (notnot (open-stream-p s))))
36  t t nil t t)
37
38(deftest make-string-output-stream.4
39  :notes (:nil-vectors-are-strings)
40  (let ((s (make-string-output-stream :element-type nil)))
41    (values
42     (notnot (typep s 'stream))
43     (notnot (typep s 'string-stream))
44     (input-stream-p s)
45     (notnot (output-stream-p s))
46     (notnot (open-stream-p s))))
47  t t nil t t)
48
49(deftest make-string-output-stream.5
50  (let ((s (make-string-output-stream :allow-other-keys nil)))
51    (values
52     (notnot (typep s 'stream))
53     (notnot (typep s 'string-stream))
54     (input-stream-p s)
55     (notnot (output-stream-p s))
56     (notnot (open-stream-p s))))
57  t t nil t t)
58
59(deftest make-string-output-stream.6
60  (let ((s (make-string-output-stream :allow-other-keys t :foo 'bar)))
61    (values
62     (notnot (typep s 'stream))
63     (notnot (typep s 'string-stream))
64     (input-stream-p s)
65     (notnot (output-stream-p s))
66     (notnot (open-stream-p s))))
67  t t nil t t)
68
69(deftest make-string-output-stream.7
70  (let ((s (make-string-output-stream :foo 'bar :allow-other-keys t
71                                      :allow-other-keys nil
72                                      :foo2 'x)))
73    (values
74     (notnot (typep s 'stream))
75     (notnot (typep s 'string-stream))
76     (input-stream-p s)
77     (notnot (output-stream-p s))
78     (notnot (open-stream-p s))))
79  t t nil t t)
80
81(deftest make-string-output-stream.8
82  (let ((s (make-string-output-stream)))
83    (write-string "abc" s)
84    (write-string "def" s)
85    (get-output-stream-string s))
86  "abcdef")
87
88(deftest make-string-output-stream.9
89  (let ((s (make-string-output-stream :element-type 'character)))
90    (write-string "abc" s)
91    (write-string "def" s)
92    (get-output-stream-string s))
93  "abcdef")
94
95(deftest make-string-output-stream.10
96  (let ((s (make-string-output-stream :element-type 'base-char)))
97    (write-string "abc" s)
98    (write-string "def" s)
99    (get-output-stream-string s))
100  "abcdef")
101
102(deftest make-string-output-stream.11
103  :notes (:nil-vectors-are-strings)
104  (let ((s (make-string-output-stream :element-type nil)))
105    (get-output-stream-string s))
106  "")
107
108(deftest make-string-output-stream.12
109  :notes (:nil-vectors-are-strings)
110  (let ((s (make-string-output-stream :element-type nil)))
111    (typep #\a (array-element-type (get-output-stream-string s))))
112  nil)
113
114(deftest make-string-output-stream.13
115  (let ((s (make-string-output-stream)))
116    (values
117     (close s)
118     (open-stream-p s)))
119  t nil)
120
121;;; Error tests
122
123(deftest make-string-output-stream.error.1
124  (signals-error (make-string-output-stream nil) program-error)
125  t)
126
127(deftest make-string-output-stream.error.2
128  (signals-error (make-string-output-stream :foo nil) program-error)
129  t)
130
131(deftest make-string-output-stream.error.3
132  (signals-error (make-string-output-stream :allow-other-keys nil
133                                            :foo 'bar)
134                 program-error)
135  t)
136
137
138
139
Note: See TracBrowser for help on using the repository browser.