source: trunk/source/tests/ansi-tests/read-delimited-list.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.5 KB
Line 
1;-*- Mode:     Lisp -*-
2;;;; Author:   Paul Dietz
3;;;; Created:  Sat Jan  1 11:17:21 2005
4;;;; Contains: Tests of READ-DELIMITED-LIST
5
6(in-package :cl-test)
7
8(deftest read-delimited-list.1
9  (with-input-from-string
10   (*standard-input* "1 2 3)")
11   (read-delimited-list #\)))
12  (1 2 3))
13
14(deftest read-delimited-list.2
15  (with-input-from-string
16   (*standard-input* "1 2 3 ]")
17   (read-delimited-list #\] nil))
18  (1 2 3))
19
20(deftest read-delimited-list.3
21  (with-input-from-string
22   (is "1 2 3)")
23   (with-open-stream
24     (os (make-broadcast-stream))
25     (with-open-stream
26      (*terminal-io* (make-two-way-stream is os))
27      (read-delimited-list #\) t))))
28  (1 2 3))
29
30(deftest read-delimited-list.4
31  (with-input-from-string
32   (is "1 2 3)X")
33   (values
34    (read-delimited-list #\) is)
35    (notnot (eql (read-char is) #\X))))
36  (1 2 3) t)
37
38(deftest read-delimited-list.5
39  (with-input-from-string
40   (is "1 2 3) X")
41   (values
42    (read-delimited-list #\) is nil)
43    (notnot (eql (read-char is) #\Space))))
44  (1 2 3) t)
45
46(deftest read-delimited-list.6
47  (with-input-from-string
48   (is (concatenate 'string "1 2 3" (string #\Newline) "]"))
49   (read-delimited-list #\] is))
50  (1 2 3))
51
52;;; Tests with RECURSIVE-P set to true must be done inside a reader macro function
53
54;;; Error tests
55
56(deftest read-delimited-list.error.1
57  (signals-error (read-delimited-list) program-error)
58  t)
59
60(deftest read-delimited-list.error.2
61  (signals-error
62   (with-input-from-string
63    (is "1 2 3)")
64    (read-delimited-list #\) is nil nil))
65   program-error)
66  t)
Note: See TracBrowser for help on using the repository browser.