source: trunk/source/tests/ansi-tests/write.lsp @ 8991

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

Check in the gcl ansi test suite (original, in preparation for making local changes)

File size: 1.8 KB
RevLine 
[8991]1;-*- Mode:     Lisp -*-
2;;;; Author:   Paul Dietz
3;;;; Created:  Thu Jul 15 06:43:55 2004
4;;;; Contains: Tests of WRITE
5
6(in-package :cl-test)
7
8(compile-and-load "printer-aux.lsp")
9;; (compile-and-load "write-aux.lsp")
10
11;;; This function is also incidentally tested elsewhere.
12
13(deftest write.1
14  (random-write-test 1000)
15  nil)
16
17(deftest write.2
18  (with-standard-io-syntax
19   (let ((*print-readably* nil))
20     (with-output-to-string
21       (*standard-output*)
22       (write 2 :stream nil))))
23  "2")
24
25(deftest write.3
26  (with-standard-io-syntax
27   (let ((*print-readably* nil))
28     (with-output-to-string
29       (os)
30       (with-input-from-string
31        (is "")
32        (with-open-stream (*terminal-io* (make-two-way-stream is os))
33                          (write 3 :stream t))))))
34  "3")
35
36(deftest write.4
37  (with-standard-io-syntax
38   (let ((*print-readably* nil))
39     (with-output-to-string
40       (os)
41       (write 4 :stream os))))
42  "4")
43
44(deftest write.5
45  (with-standard-io-syntax
46   (let ((*print-readably* nil))
47     (with-output-to-string
48       (*standard-output*)
49       (write 5 :allow-other-keys nil))))
50  "5")
51
52(deftest write.6
53  (with-standard-io-syntax
54   (let ((*print-readably* nil))
55     (with-output-to-string
56       (*standard-output*)
57       (write 6 :allow-other-keys t :foo 'bar))))
58  "6")
59
60(deftest write.7
61  (with-standard-io-syntax
62   (let ((*print-readably* nil))
63     (with-output-to-string
64       (*standard-output*)
65       (write 7 :base 10 :base 3))))
66  "7")
67
68;;; Error tests
69
70(deftest write.error.1
71  (signals-error (write) program-error)
72  t)
73
74(deftest write.error.2
75  (signals-error (write 1 :stream) program-error)
76  t)
77
78(deftest write.error.3
79  (signals-error (write 1 :allow-other-keys nil :foo 'bar) program-error)
80  t)
81
82(deftest write.error.4
83  (signals-error (write 1 :allow-other-keys nil :allow-other-keys t :foo 'bar) program-error)
84  t)
85
86
87
88
89
90
91
92
Note: See TracBrowser for help on using the repository browser.