source: trunk/tests/ansi-tests/stream-element-type.lsp @ 9045

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

Assorted cleanup:

In infrastructure:

  • add *test-verbose* and :verbose argument to do-test and do-tests. Avoid random output if false, only show failures
  • muffle-wawrnings and/or bind *suppress-compiler-warnings* in some tests that unavoidably generate them (mainly with duplicate typecase/case clauses)
  • Add record-source-file for tests so meta-. can find them
  • If *catch-errors* (or the :catch-errors arg) is :break, enter a breakloop when catch an error
  • Make test fns created by *compile-tests* have names, so can find them in backtraces
  • fix misc compiler warnings
  • Fixed cases of duplicate test numbers
  • Disable note :make-condition-with-compound-name for openmcl.

In tests themselves:

I commented out the following tests with #+bogus-test, because they just seemed wrong to me:

lambda.47
lambda.50
upgraded-array-element-type.8
upgraded-array-element-type.nil.1
pathname-match-p.5
load.17
load.18
macrolet.47
ctypecase.15

In addition, I commented out the following tests with #+bogus-test because I was too lazy to make a note
for "doesn't signal underflow":

exp.error.8 exp.error.9 exp.error.10 exp.error.11 expt.error.8 expt.error.9 expt.error.10 expt.error.11

Finally, I entered bug reports in trac, and then commented out the tests
below with #+known-bug-NNN, where nnn is the ticket number in trac:

ticket#268: encode-universal-time.3 encode-universal-time.3.1
ticket#269: macrolet.36
ticket#270: values.20 values.21
ticket#271: defclass.error.13 defclass.error.22
ticket#272: phase.10 phase.12 asin.5 asin.6 asin.8
ticket#273: phase.18 phase.19 acos.8
ticket#274: exp.error.4 exp.error.5 exp.error.6 exp.error.7
ticket#275: car.error.2 cdr.error.2
ticket#276: map.error.11
ticket#277: subtypep.cons.43
ticket#278: subtypep-function.3
ticket#279: subtypep-complex.8
ticket#280: open.output.19 open.io.19 file-position.8 file-length.4 file-length.5 read-byte.4 stream-element-type.2 stream-element-type.3
ticket#281: open.65
ticket#288: set-syntax-from-char.sharp.1

File size: 2.7 KB
Line 
1;-*- Mode:     Lisp -*-
2;;;; Author:   Paul Dietz
3;;;; Created:  Tue Jan 13 20:09:50 2004
4;;;; Contains: Tests for STREAM-ELEMENT-TYPE
5
6(in-package :cl-test)
7
8(deftest stream-element-type.1
9  (loop for s in (list *debug-io* *error-output* *query-io*
10                       *standard-input* *standard-output*
11                       *trace-output* *terminal-io*)
12        for results = (multiple-value-list (stream-element-type s))
13        unless (and (eql (length results) 1)
14                    (car results))
15        collect s)
16  nil)
17
18#+known-bug-280
19(deftest stream-element-type.2
20  (let ((pn "foo.txt"))
21    (loop for i from 1 to 100
22          for etype = `(unsigned-byte ,i)
23          for s = (progn (delete-all-versions pn)
24                         (open pn :direction :output
25                               :element-type etype))
26          unless
27          (multiple-value-bind (sub good)
28              (subtypep etype (stream-element-type s))
29            (close s)
30            (or sub (not good)))
31          collect i))
32  nil)
33
34#+known-bug-280
35(deftest stream-element-type.3
36  (let ((pn "foo.txt"))
37    (loop for i from 1 to 100
38          for etype = `(signed-byte ,i)
39          for s = (progn (delete-all-versions pn)
40                         (open pn :direction :output
41                               :element-type etype))
42          unless
43          (multiple-value-bind (sub good)
44              (subtypep etype (stream-element-type s))
45            (close s)
46            (or sub (not good)))
47          collect i))
48  nil)
49
50(deftest stream-element-type.4
51  (let ((pn "foo.txt"))
52    (loop for i from 1 to 100
53          for etype = `(integer 0 ,i)
54          for s = (progn (delete-all-versions pn)
55                         (open pn :direction :output
56                               :element-type etype))
57          unless
58          (multiple-value-bind (sub good)
59              (subtypep etype (stream-element-type s))
60            (close s)
61            (or sub (not good)))
62          collect i))
63  nil)
64
65
66(deftest stream-element-type.5
67  :notes (:assume-no-simple-streams)
68  (let ((pn "foo.txt"))
69    (delete-all-versions pn)
70    (let ((s (open pn :direction :output)))
71      (let ((etype (stream-element-type s)))
72        (unwind-protect
73            (equalt (multiple-value-list (subtypep* 'character etype))
74                    '(nil t))
75          (close s)))))
76  nil)
77
78(deftest stream-element-type.6
79  :notes (:assume-no-simple-streams)
80  (let ((pn "foo.txt"))
81    (delete-all-versions pn)
82    (let ((s (open pn :direction :output
83                   :element-type :default)))
84      (let ((etype (stream-element-type s)))
85        (unwind-protect
86            (multiple-value-bind (sub1 good1) (subtypep* etype 'integer)
87              (multiple-value-bind (sub2 good2) (subtypep* etype 'character)
88                (or (not good1)
89                    (not good2)
90                    sub1 sub2)))
91          (close s)))))
92  t)
93
94(deftest stream-element-type.error.1
95  (signals-error (stream-element-type) program-error)
96  t)
97
98(deftest stream-element-type.error.2
99  (signals-error (stream-element-type *standard-input* nil) program-error)
100  t)
101
102(deftest stream-element-type.error.3
103  (check-type-error #'stream-element-type #'streamp)
104  nil)
Note: See TracBrowser for help on using the repository browser.