special.lsp 727 Bytes
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
;-*- Mode:     Lisp -*-
;;;; Author:   Paul Dietz
;;;; Created:  Sat May 21 12:51:59 2005
;;;; Contains: Tests of the declaration SPECIAL

(in-package :cl-test)

;;; Many tests for this declaration are in the tests
;;; for specific binding forms.

(deftest special.1
  (let ((f 1))
    (declare (special f))
    (flet ((f () :good))
      (flet ((g () (f)))
sds's avatar
sds committed
16 17
        (flet ((f () :bad))
          (g)))))
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
  :good)

(deftest special.2
  (let ((x 'a))
    (declare (special x))
    (let ((x 'b))
      (values x (locally (declare (special x)) x) x)))
  b a b)

(deftest special.3
  (flet ((%f () (declare (special x10)) x10))
    (let ((x10 'a))
      (declare (special x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12))
      (%f)))
  a)