source: trunk/source/tests/ansi-tests/make-symbol.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.9 KB
Line 
1;-*- Mode:     Lisp -*-
2;;;; Author:   Paul Dietz
3;;;; Created:  Sat Jun 14 05:45:21 2003
4;;;; Contains: Tests of MAKE-SYMBOL
5
6(in-package :cl-test)
7
8(deftest make-symbol.1
9  (notnot-mv (symbolp (make-symbol "FOO")))
10  t)
11
12(deftest make-symbol.2
13  (symbol-package (make-symbol "BAR"))
14  nil)
15
16(deftest make-symbol.3
17  (symbol-package (make-symbol "CL::FOO"))
18  nil)
19
20(deftest make-symbol.4
21  (symbol-package (make-symbol "CL:FOO"))
22  nil)
23
24(deftest make-symbol.5
25  (symbol-name (make-symbol "xyz"))
26  "xyz")
27
28(deftest make-symbol.6
29    (eqt (make-symbol "A")
30        (make-symbol "A"))
31  nil)
32
33(deftest make-symbol.7
34  (boundp (make-symbol "B"))
35  nil)
36
37(deftest make-symbol.8
38  (symbol-plist (make-symbol "C"))
39  nil)
40
41(deftest make-symbol.9
42  (fboundp (make-symbol "D"))
43  nil)
44
45(deftest make-symbol.10
46  (symbol-name (make-symbol ""))
47  "")
48
49(deftest make-symbol.11
50  :notes (:nil-vectors-are-strings)
51  (symbol-name (make-symbol (make-array '(0) :element-type nil)))
52  "")
53
54(deftest make-symbol.12
55  (let* ((name (make-array '(4) :initial-contents '(#\A #\B #\C #\D)
56                           :element-type 'base-char))
57         (s (make-symbol name))
58         (name2 (symbol-name s)))
59    (values
60     (symbol-package s)
61     (string=t name2 "ABCD")))
62  nil t)
63
64(deftest make-symbol.13
65  (let* ((name (make-array '(6) :initial-contents '(#\A #\B #\C #\D #\E #\F)
66                           :element-type 'character
67                           :fill-pointer 4))
68         (s (make-symbol name))
69         (name2 (symbol-name s)))
70    (values
71     (symbol-package s)
72     (string=t name2 "ABCD")))
73  nil t)
74
75(deftest make-symbol.14
76  (let* ((name (make-array '(4) :initial-contents '(#\A #\B #\C #\D)
77                           :adjustable t
78                           :element-type 'character))
79         (s (make-symbol name))
80         (name2 (symbol-name s)))
81    (values
82     (symbol-package s)
83     (string=t name2 "ABCD")))
84  nil t)
85
86(deftest make-symbol.15
87  (let* ((name0 (make-array '(6) :initial-contents '(#\0 #\A #\B #\C #\D #\E)
88                            :element-type 'character))
89         (name (make-array '(4) :element-type 'character
90                           :displaced-to name0
91                           :displaced-index-offset 1))
92         (s (make-symbol name))
93         (name2 (symbol-name s)))
94    (values
95     (symbol-package s)
96     (string=t name2 "ABCD")))
97  nil t)
98
99(deftest make-symbol.16
100  (let* ((name0 (make-array '(6) :initial-contents '(#\0 #\A #\B #\C #\D #\E)
101                            :element-type 'base-char))
102         (name (make-array '(4) :element-type 'base-char
103                           :displaced-to name0
104                           :displaced-index-offset 1))
105         (s (make-symbol name))
106         (name2 (symbol-name s)))
107    (values
108     (symbol-package s)
109     (string=t name2 "ABCD")))
110  nil t)
111
112
113(deftest make-symbol.order.1
114  (let ((i 0))
115    (values
116     (symbol-name (make-symbol (progn (incf i) "ABC")))
117     i))
118  "ABC" 1)
119
120(deftest make-symbol.error.1
121  (check-type-error #'make-symbol #'stringp)
122  nil)
123
124(deftest make-symbol.error.9
125  (signals-error (make-symbol) program-error)
126  t)
127
128(deftest make-symbol.error.10
129  (signals-error (make-symbol "a" "a") program-error)
130  t)
131
132(deftest make-symbol.error.11
133  (signals-type-error x '(#\a #\b #\c) (make-symbol x))
134  t)
Note: See TracBrowser for help on using the repository browser.