Commit 1f037a6d authored by pfdietz's avatar pfdietz

Order of eval tests

parent 50a61794
......@@ -86,6 +86,54 @@
fn)
nil)
(deftest macro-function.12
(let ((sym (gensym)))
(eval `(defmacro ,sym () t))
(let ((i 0))
(values
(funcall (macro-function (progn (incf i) sym)) (list sym) nil)
i)))
t 1)
(deftest macro-function.13
(let ((sym (gensym)))
(eval `(defmacro ,sym () t))
(let ((i 0) a b)
(values
(funcall (macro-function (progn (setf a (incf i)) sym)
(progn (setf b (incf i)) nil))
(list sym) nil)
i a b)))
t 2 1 2)
(deftest macro-function.14
(let ((sym (gensym))
(i 0))
(setf (macro-function (progn (incf i) sym)) (macro-function 'pop))
(values
(eval `(let ((x '(a b c)))
(list
(,sym x)
x)))
i))
(a (b c)) 1)
(deftest macro-function.15
(let ((sym (gensym))
(i 0) a b)
(setf (macro-function (progn (setf a (incf i)) sym)
(progn (setf b (incf i)) nil))
(macro-function 'pop))
(values
(eval `(let ((x '(a b c)))
(list
(,sym x)
x)))
i a b))
(a (b c)) 2 1 2)
;;; Error tests
(deftest macro-function.error.1
......
......@@ -16,32 +16,49 @@
;;; Non-error tests
(deftest macroexpand-1.1
(loop for x in *universe*
unless (or (symbolp x)
(consp x)
(eql (macroexpand-1 x) x))
collect (list x (macroexpand-1 x)))
(let (vals)
(loop for x in *universe*
unless (or (symbolp x)
(consp x)
(progn
(setq vals (multiple-value-list (macroexpand-1 x)))
(and (= (length vals) 2)
(eql (car vals) x)
(null (cadr vals)))))
collect (cons x vals)))
nil)
(deftest macroexpand-1.2
(loop for x in *universe*
unless (or (symbolp x)
(consp x)
(eql (macroexpand-1 x nil) x))
collect (list x (macroexpand-1 x nil)))
(let (vals)
(loop for x in *universe*
unless (or (symbolp x)
(consp x)
(progn
(setq vals (multiple-value-list (macroexpand-1 x nil)))
(and (= (length vals) 2)
(eql (car vals) x)
(null (cadr vals)))))
collect (cons x vals)))
nil)
(deftest macroexpand-1.3
(macrolet ((%m (&environment env)
`(quote
,(loop for x in *universe*
unless (or (symbolp x)
(consp x)
(eql (macroexpand-1 x env) x))
collect (list x (macroexpand-1 x env))))))
(macrolet
((%m (&environment env)
`(quote
,(let (vals)
(loop for x in *universe*
unless (or (symbolp x)
(consp x)
(progn
(setq vals (multiple-value-list (macroexpand-1 x env)))
(and (= (length vals) 2)
(eql (car vals) x)
(null (cadr vals)))))
collect (cons x vals))))))
(%m))
nil)
(deftest macroexpand-1.4
(macrolet ((%m () ''foo))
(macrolet ((%m2 (&environment env)
......@@ -49,10 +66,20 @@
(%m2)))
foo)
(deftest macroexpand-1.5
(let ((form (list (gensym)))
(i 0))
(values
(equalt (macroexpand-1 (progn (incf i) form)) form)
i))
t 1)
(deftest macroexpand-1.6
(let ((form (list (gensym)))
(i 0) a b)
(values
(equalt (macroexpand-1 (progn (setf a (incf i)) form)
(progn (setf b (incf i)) nil))
form)
i a b))
t 2 1 2)
......@@ -16,32 +16,49 @@
;;; Non-error tests
(deftest macroexpand.1
(loop for x in *universe*
unless (or (symbolp x)
(consp x)
(eql (macroexpand x) x))
collect (list x (macroexpand x)))
(let (vals)
(loop for x in *universe*
unless (or (symbolp x)
(consp x)
(progn
(setq vals (multiple-value-list (macroexpand x)))
(and (= (length vals) 2)
(eql (car vals) x)
(null (cadr vals)))))
collect (cons x vals)))
nil)
(deftest macroexpand.2
(loop for x in *universe*
unless (or (symbolp x)
(consp x)
(eql (macroexpand x nil) x))
collect (list x (macroexpand x nil)))
(let (vals)
(loop for x in *universe*
unless (or (symbolp x)
(consp x)
(progn
(setq vals (multiple-value-list (macroexpand x nil)))
(and (= (length vals) 2)
(eql (car vals) x)
(null (cadr vals)))))
collect (cons x vals)))
nil)
(deftest macroexpand.3
(macrolet ((%m (&environment env)
`(quote
,(loop for x in *universe*
unless (or (symbolp x)
(consp x)
(eql (macroexpand x env) x))
collect (list x (macroexpand x env))))))
(macrolet
((%m (&environment env)
`(quote
,(let (vals)
(loop for x in *universe*
unless (or (symbolp x)
(consp x)
(progn
(setq vals (multiple-value-list (macroexpand x env)))
(and (= (length vals) 2)
(eql (car vals) x)
(null (cadr vals)))))
collect (cons x vals))))))
(%m))
nil)
(deftest macroexpand.4
(macrolet ((%m () ''foo))
(macrolet ((%m2 (&environment env)
......@@ -49,9 +66,20 @@
(%m2)))
foo)
(deftest macroexpand.5
(let ((form (list (gensym)))
(i 0))
(values
(equalt (macroexpand (progn (incf i) form)) form)
i))
t 1)
(deftest macroexpand.6
(let ((form (list (gensym)))
(i 0) a b)
(values
(equalt (macroexpand (progn (setf a (incf i)) form)
(progn (setf b (incf i)) nil))
form)
i a b))
t 2 1 2)
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