Commit 1854d4d7 authored by pfdietz's avatar pfdietz
Browse files

Test that TYPEP evaluates its first argument just once; also, tests of setq,...

Test that TYPEP evaluates its first argument just once; also, tests of setq, setf, psetq, and psetf on special variables.
parent e84ba37f
...@@ -227,6 +227,19 @@ ...@@ -227,6 +227,19 @@
(let (x) (setq x (values 1 2))) (let (x) (setq x (values 1 2)))
1) 1)
(deftest setq.5
(let ((*x* 0))
(declare (special *x*))
(values *x* (setq *x* 1) *x*))
0 1 1)
(deftest setq.6
(let ((*x* 0))
(declare (special *x*))
(setq *x* 1))
1)
(deftest setf.1 (deftest setf.1
(setf) (setf)
nil) nil)
...@@ -244,3 +257,15 @@ ...@@ -244,3 +257,15 @@
(deftest setf.4 (deftest setf.4
(let (x) (setf x (values 1 2))) (let (x) (setf x (values 1 2)))
1) 1)
(deftest setf.5
(let ((*x* 0))
(declare (special *x*))
(values *x* (setf *x* 1) *x*))
0 1 1)
(deftest setf.6
(let ((*x* 0))
(declare (special *x*))
(setf *x* 1))
1)
...@@ -92,4 +92,24 @@ ...@@ -92,4 +92,24 @@
a) a)
#(0 2 2 4 4 5 6 7 8 9)) #(0 2 2 4 4 5 6 7 8 9))
(deftest psetf.10
(let ((*x* 0) (*y* 10))
(declare (special *x* *y*))
(values
*x* *y*
(psetf *x* 6
*y* 15)
*x* *y*))
0 10 nil 6 15)
(deftest psetf.11
(let ((*x* 0) (*y* 10))
(declare (special *x* *y*))
(values
*x* *y*
(psetf *x* *y*
*y* *x*)
*x* *y*))
0 10 nil 10 0)
(def-macro-test psetf.error.1 (psetf)) (def-macro-test psetf.error.1 (psetf))
...@@ -58,6 +58,28 @@ ...@@ -58,6 +58,28 @@
#(0 2 2 4 4 5 6 7 8 9) #(0 2 2 4 4 5 6 7 8 9)
4) 4)
(deftest psetq.8
(let ((*x* 0) (*y* 10))
(declare (special *x* *y*))
(values
*x* *y*
(psetq *x* 6
*y* 15)
*x* *y*))
0 10 nil 6 15)
(deftest psetq.9
(let ((*x* 0) (*y* 10))
(declare (special *x* *y*))
(values
*x* *y*
(psetq *x* *y*
*y* *x*)
*x* *y*))
0 10 nil 10 0)
(deftest psetq.error.1 (deftest psetq.error.1
(classify-error (funcall (macro-function 'psetq))) (classify-error (funcall (macro-function 'psetq)))
program-error) program-error)
......
...@@ -420,3 +420,10 @@ ...@@ -420,3 +420,10 @@
(c2 (find-class 'symbol))) (c2 (find-class 'symbol)))
(notnot-mv (typep 'a `(or ,c2 ,c1)))) (notnot-mv (typep 'a `(or ,c2 ,c1))))
t) t)
(deftest typep.18
(let ((i 0))
(values
(notnot (typep (incf i) '(and (integer 0 10) (integer -5 6))))
i))
t 1)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment