From ac007919a15d8cc42f06c8b7e41a6b3f4656219d Mon Sep 17 00:00:00 2001 From: pfdietz <pfdietz@localhost> Date: Sun, 29 May 2005 12:30:13 +0000 Subject: [PATCH] Added tests for DECLARATION --- ansi-tests/declaration.lsp | 88 ++++++++++++++++++++++++++++ ansi-tests/load-eval-and-compile.lsp | 1 + 2 files changed, 89 insertions(+) create mode 100644 ansi-tests/declaration.lsp diff --git a/ansi-tests/declaration.lsp b/ansi-tests/declaration.lsp new file mode 100644 index 00000000..e3f7b9e9 --- /dev/null +++ b/ansi-tests/declaration.lsp @@ -0,0 +1,88 @@ +;-*- 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." + +(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) error) + (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) + + + + + + + diff --git a/ansi-tests/load-eval-and-compile.lsp b/ansi-tests/load-eval-and-compile.lsp index ffdf524e..f29872f5 100644 --- a/ansi-tests/load-eval-and-compile.lsp +++ b/ansi-tests/load-eval-and-compile.lsp @@ -21,3 +21,4 @@ (load "special.lsp") (load "macroexpand.lsp") (load "macroexpand-1.lsp") +(load "declaration.lsp") -- GitLab