set.lsp 1.32 KB
Newer Older
1 2 3 4 5 6 7 8 9
;-*- Mode:     Lisp -*-
;;;; Author:   Paul Dietz
;;;; Created:  Sat Jun 21 22:35:48 2003
;;;; Contains: Tests of SET

(in-package :cl-test)

(deftest set.1
  (let ((*var-used-in-set-tests* 'a)
sds's avatar
sds committed
10
        (var '*var-used-in-set-tests*))
11 12 13 14 15 16 17 18 19
    (declare (special *var-used-in-set-tests*))
    (values
     *var-used-in-set-tests*
     (set var 'b)
     *var-used-in-set-tests*))
  a b b)

(deftest set.2
  (let ((*var-used-in-set-tests* 'a)
sds's avatar
sds committed
20
        (var '*var-used-in-set-tests*))
21 22 23 24 25 26 27 28 29
    (declare (special *var-used-in-set-tests*))
    (values
     (let ((*var-used-in-set-tests* 'c))
       (list (set var 'b) *var-used-in-set-tests* (symbol-value var)))
     *var-used-in-set-tests*))
  (b c b)
  b)

(deftest set.error.1
30 31
  (signals-error (set) program-error)
  t)
32 33

(deftest set.error.2
34
  (signals-error
35 36
   (let ((*var-used-in-set-tests* 'a))
     (declare (special *var-used-in-set-tests*))
37 38 39
     (set '*var-used-in-set-tests*))
   program-error)
  t)
40 41

(deftest set.error.3
42
  (signals-error
43 44
   (let ((*var-used-in-set-tests* 'a))
     (declare (special *var-used-in-set-tests*))
45 46 47
     (set '*var-used-in-set-tests* nil nil))
   program-error)
  t)
48 49

(deftest set.error.4
50
  (signals-error
51 52
   (let ((*var-used-in-set-tests* 'a) (*y* 'b))
     (declare (special *var-used-in-set-tests*))
53 54 55
     (set '*var-used-in-set-tests* nil '*y* nil))
   program-error)
  t)