fboundp.lsp 1.43 KB
Newer Older
1
2
3
4
5
6
7
8
;-*- Mode:     Lisp -*-
;;;; Author:   Paul Dietz
;;;; Created:  Mon Oct  7 22:37:22 2002
;;;; Contains: Tests of FBOUNDP

(in-package :cl-test)

(deftest fboundp.1
9
  (not-mv (fboundp 'car))
10
11
12
  nil)

(deftest fboundp.2
13
  (not-mv (fboundp 'cdr))
14
15
16
  nil)

(deftest fboundp.3
17
  (not-mv (fboundp 'defun))  ; a macro
18
19
20
21
22
23
24
25
26
  nil)

(deftest fboundp.4
  ;; fresh symbols are not fbound
  (let ((g (gensym))) (fboundp g))
  nil)

(defun fboundp-5-fn (x) x)
(deftest fboundp.5
27
  (not-mv (fboundp 'fboundp-5-fn))
28
29
  nil)

30
31
(report-and-ignore-errors
 (defun (setf fboundp-6-accessor) (y x) (setf (car x) y)))
32
33

(deftest fboundp.6
34
  (not-mv (fboundp '(setf fboundp-6-accessor)))
35
36
37
38
39
40
  nil)

(deftest fboundp.7
  (let ((g (gensym))) (fboundp (list 'setf g)))
  nil)

41
42
43
;;; See 11.1.2.1.1
(deftest fboundp.8
  (loop for x in *cl-non-function-macro-special-operator-symbols*
44
	when (and (fboundp x) (not (eq x 'ed)))
45
46
47
	collect x)
  nil)

48
49
50
51
52
(deftest fboundp.order.1
  (let ((i 0))
    (values (notnot (fboundp (progn (incf i) 'car))) i))
  t 1)

53
(deftest fboundp.error.1
54
  (classify-error (fboundp 1))
55
56
  type-error)

57
(deftest fboundp.error.2
58
  (classify-error (fboundp #\a))
59
60
  type-error)

61
(deftest fboundp.error.3
62
  (classify-error (fboundp '(foo)))
63
64
  type-error)

65
66
67
(deftest fboundp.error.4
  (classify-error (fboundp))
  program-error)
68

69
70
71
(deftest fboundp.error.5
  (classify-error (fboundp 'cons nil))
  program-error)
72
73
74
75

(deftest fboundp.error.6
  (classify-error (locally (fboundp 1) t))
  type-error)