source: trunk/source/tests/ansi-tests/special-operator-p.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.5 KB
Line 
1;-*- Mode:     Lisp -*-
2;;;; Author:   Paul Dietz
3;;;; Created:  Sat Jun 14 05:51:41 2003
4;;;; Contains: Tests fo SPECIAL-OPERATOR-P
5
6(in-package :cl-test)
7
8;;; See section 3.1.2.1.2.1
9(defparameter +special-operators+
10  '(block let* return-from catch load-time-value setq eval-when
11          locally symbol-macrolet flet macrolet tagbody function
12          multiple-value-call the go multiple-value-prog1 throw if
13          progn unwind-protect labels progv let quote))
14
15
16;;; All the symbols in +special-operators+ are special operators
17(deftest special-operator-p.1
18  (loop for s in +special-operators+
19        unless (special-operator-p s)
20        collect s)
21  nil)
22
23;;; None of the standard symbols except those in +special-operators+
24;;; are special operators, unless they have a macro function
25;;; (See the page for MACRO-FUNCTION)
26
27(deftest special-operator-p.2
28  (let ((p (find-package "CL")))
29    (loop for name in *cl-symbol-names*
30          unless (or (member name +special-operators+ :test #'string=)
31                     (let ((sym (find-symbol name p)))
32                       (or (not (special-operator-p sym))
33                           (macro-function sym))))
34          collect name))
35  nil)
36
37(deftest special-operator-p.order.1
38  (let ((i 0))
39    (values (notnot (special-operator-p (progn (incf i) 'catch)))
40            i))
41  t 1)
42
43(deftest special-operator-p.error.1
44  (check-type-error #'special-operator-p #'symbolp)
45  nil)
46
47(deftest special-operator-p.error.2
48  (signals-error (special-operator-p) program-error)
49  t)
50
51(deftest special-operator-p.error.3
52  (signals-error (special-operator-p 'cons 'cons) program-error)
53  t)
Note: See TracBrowser for help on using the repository browser.