File: declaration.lsp

package info (click to toggle)
cl-ansi-tests 20071218-1
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 7,000 kB
  • ctags: 22,025
  • sloc: lisp: 134,798; makefile: 144
file content (96 lines) | stat: -rw-r--r-- 2,303 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
;-*- Mode:     Lisp -*-
;;;; Author:   Paul Dietz
;;;; Created:  Sun May 29 07:16:15 2005
;;;; Contains: Tests of the DECLARATION declarations


(in-package :cl-test)

(deftest declaration.1
  (progn (declaim (declaration)) nil)
  nil)

(deftest declaration.2
  (progn (proclaim '(declaration)) nil)
  nil)

(deftest declaration.3
  (let ((sym (gensym))
	(sym2 (gensym)))
    (proclaim `(declaration ,sym ,sym2))
    nil)
  nil)

;;; For the error tests, see the page in the CLHS for TYPE:
;;; "A symbol cannot be both the name of a type and the name
;;;  of a declaration. Defining a symbol as the name of a class,
;;;  structure, condition, or type, when the symbol has been
;;;  declared as a declaration name, or vice versa, signals an error."

;;; Declare these only if bad declarations produce warnings.

(when (block done
	(handler-bind ((warning #'(lambda (c) (return-from done t))))
		      (eval `(let () (declare (,(gensym))) nil))))

(deftest declaration.4
  (let ((sym (gensym)))
    (proclaim `(declaration ,sym))
    (eval `(signals-error-always (deftype ,sym () t) error)))
  t t)

(deftest declaration.5
  (let ((sym (gensym)))
    (proclaim `(declaration ,sym))
    (eval `(signals-error-always (defstruct ,sym a b c) error)))
  t t)

(deftest declaration.6
  (let ((sym (gensym)))
    (proclaim `(declaration ,sym))
    (eval `(signals-error-always (defclass ,sym () (a b c)) error)))
  t t)

(deftest declaration.7
  (let ((sym (gensym)))
    (proclaim `(declaration ,sym))
    (eval `(signals-error-always (define-condition ,sym (condition) (a b c))
				 error)))
  t t)

(deftest declaration.8
  (let ((sym (gensym)))
    (eval `(deftype ,sym () 'error))
    (eval `(signals-error-always (proclaim '(declaration ,sym))
				 error)))
  t t)

(deftest declaration.9
  (let ((sym (gensym)))
    (eval `(defstruct ,sym a b c))
    (eval `(signals-error-always (proclaim '(declaration ,sym))
				 error)))
  t t)

(deftest declaration.10
  (let ((sym (gensym)))
    (eval `(defclass ,sym () (a b c)))
    (eval `(signals-error-always (proclaim '(declaration ,sym))
				 error)))
  t t)

(deftest declaration.11
  (let ((sym (gensym)))
    (eval `(define-condition ,sym (condition) (a b c)))
    (eval `(signals-error-always (proclaim '(declaration ,sym))
				 error)))
  t t)

)