source: trunk/source/tests/ansi-tests/dispatch-macro-characters.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: 2.0 KB
Line 
1;-*- Mode:     Lisp -*-
2;;;; Author:   Paul Dietz
3;;;; Created:  Sat Feb  5 11:42:24 2005
4;;;; Contains: Tests of dispatch macro character functions
5
6(in-package :cl-test)
7
8(deftest make-dispatch-macro-character.1
9  (with-standard-io-syntax
10   (let* ((*readtable* (copy-readtable nil))
11          (*package* (find-package "CL-TEST")))
12     (values
13      (make-dispatch-macro-character #\!)
14      (read-from-string "123!"))))
15  t 123)
16
17(deftest make-dispatch-macro-character.2
18  (with-standard-io-syntax
19   (let* ((*readtable* (copy-readtable nil))
20          (*package* (find-package "CL-TEST")))
21     (values
22      (make-dispatch-macro-character #\! t)
23      (read-from-string "123!"))))
24  t 123!)
25
26(deftest make-dispatch-macro-character.3
27  (with-standard-io-syntax
28   (let* ((*readtable* (copy-readtable nil))
29          (*package* (find-package "CL-TEST")))
30     (values
31      (make-dispatch-macro-character #\!)
32      (loop for c across +standard-chars+
33            for result = (handler-case
34                          (read-from-string (coerce (list #\! c #\X) 'string))
35                          (reader-error (c) :good)
36                          (error (c) :bad))
37            unless (eql result :good)
38            collect (list c result)))))
39  t nil)
40
41(deftest make-dispatch-macro-character.4
42  (with-standard-io-syntax
43   (let* ((rt (copy-readtable nil))
44          (*package* (find-package "CL-TEST")))
45     (values
46      (make-dispatch-macro-character #\! t rt)
47      (read-from-string "!")
48      (let ((*readtable* rt))
49        (read-from-string "123!")))))
50  t ! 123!)
51
52(deftest make-dispatch-macro-character.error.1
53  (let ((*readtable* (copy-readtable nil)))
54    (signals-error (make-dispatch-macro-character) program-error))
55  t)
56
57(deftest make-dispatch-macro-character.error.2
58  (let ((*readtable* (copy-readtable nil)))
59    (signals-error (make-dispatch-macro-character #\! t *readtable* nil)
60                   program-error))
61  t)
62
63;;; GET-DISPATCH-MACRO-CHARACTER
64
65(deftest get-dispatch-macro-character.1
66  (loop for c across +standard-chars+
67        when (and (not (eql c #\#))
68                          (handler-case
69                           (list
70                             (get-dispatch-macro-character c #\a)
71                             c)
72                           (error (cnd) nil)))
73        collect it)
74  nil)
75
76
77
78         
Note: See TracBrowser for help on using the repository browser.