source: trunk/source/tests/ansi-tests/fmakunbound.lsp @ 8991

Last change on this file since 8991 was 8991, checked in by gz, 11 years ago

Check in the gcl ansi test suite (original, in preparation for making local changes)

File size: 1.8 KB
Line 
1;-*- Mode:     Lisp -*-
2;;;; Author:   Paul Dietz
3;;;; Created:  Tue Oct  8 00:09:14 2002
4;;;; Contains: Tests for FMAKUNBOUND
5
6(in-package :cl-test)
7
8(deftest fmakunbound.1
9  (let ((g (gensym)))
10    (and (not (fboundp g))
11         (setf (symbol-function g) #'car)
12         (fboundp g)
13         (values (eqt (check-values (fmakunbound g)) g)
14                 (fboundp g))))
15  t nil)
16
17(deftest fmakunbound.2
18  (let ((g (gensym)))
19    (and (not (fboundp g))
20         (eval `(defun ,g () nil))
21         (fboundp g)
22         (values (eqt (check-values (fmakunbound g)) g)
23                 (fboundp g))))
24  t nil)
25
26(deftest fmakunbound.3
27  (let ((g (gensym)))
28    (and (not (fboundp g))
29         (eval `(defmacro ,g () nil))
30         (fboundp g)
31         (values (eqt (check-values (fmakunbound g)) g)
32                 (fboundp g))))
33  t nil)
34
35(deftest fmakunbound.4
36  (let* ((g (gensym))
37         (n `(setf ,g)))
38    (and (not (fboundp n))
39         (eval `(defun ,n () nil))
40         (fboundp n)
41         (values (equalt (check-values (fmakunbound n)) n)
42                 (fboundp n))))
43  t nil)
44
45(deftest fmakunbound.error.1
46  (check-type-error #'fmakunbound
47                    #'(lambda (x) (typep x '(or symbol (cons (eql setf) (cons symbol null))))))
48  nil)
49
50(deftest fmakunbound.error.2
51  (check-type-error #'fmakunbound (constantly nil)
52                    '((setf) (setf . foo) (setf foo . bar) (setf foo bar)))
53  nil)
54
55(deftest fmakunbound.error.3
56  (signals-type-error x '(x) (fmakunbound x))
57  t)
58
59(deftest fmakunbound.error.4
60  (signals-error (fmakunbound) program-error)
61  t)
62
63(deftest fmakunbound.error.5
64  (signals-error (fmakunbound (gensym) nil) program-error)
65  t)
66
67(deftest fmakunbound.error.6
68  (signals-error (locally (fmakunbound 1) t) type-error)
69  t)
70
71(deftest fmakunbound.error.7
72  (loop for x in *mini-universe*
73        unless (symbolp x)
74        nconc
75        (handler-case
76         (list x (fmakunbound `(setf ,x)))
77         (type-error (c)
78                     (assert (not (typep (type-error-datum c)
79                                         (type-error-expected-type c))))
80                     nil)
81         (error (c) (list (list x c)))))
82  nil)
Note: See TracBrowser for help on using the repository browser.