boundp.lsp 1.17 KB
Newer Older
1 2 3 4 5 6 7 8
;-*- Mode:     Lisp -*-
;;;; Author:   Paul Dietz
;;;; Created:  Tue Jan 14 05:58:01 2003
;;;; Contains: Tests for BOUNDP

(in-package :cl-test)

(deftest boundp.error.1
9 10
  (signals-error (boundp) program-error)
  t)
11 12

(deftest boundp.error.2
13 14
  (signals-error (boundp 'a 'a) program-error)
  t)
15 16

(deftest boundp.error.3
17 18
  (check-type-error #'boundp #'symbolp)
  nil)
19 20

(deftest boundp.error.4
21
  (signals-type-error x '(setf car) (boundp x))
22
  t)
23 24

(deftest boundp.error.5
25
  (signals-type-error x "abc" (boundp x))
26
  t)
27

28
(deftest boundp.error.6
29
  (signals-type-error x "abc" (locally (boundp x) t))
30
  t)
31

32 33 34
;;; See other tests in cl-symbols.lsp

(deftest boundp.1
35
  (notnot-mv (boundp 't))
36 37 38
  t)

(deftest boundp.2
39
  (notnot-mv (boundp nil))
40 41 42
  t)

(deftest boundp.3
43
  (notnot-mv (boundp :foo))
44 45 46 47 48
  t)

(deftest boundp.4
  (boundp '#:foo)
  nil)
49

50 51 52
;;; See 11.1.2.1.1
(deftest boundp.5
  (loop for x in *cl-non-variable-constant-symbols*
sds's avatar
sds committed
53 54
        when (boundp x)
        collect x)
55 56
  nil)

57 58 59 60
(deftest boundp.6
  (macrolet ((%m (z) z)) (boundp (expand-in-current-env (%m '#:foo))))
  nil)

61 62 63 64 65 66 67
(deftest boundp.order.1
  (let ((i 0) x)
    (values
     (boundp (progn (setf x (incf i)) '#:foo))
     i x))
  nil 1 1)