diff --git a/ansi-tests/macro-function.lsp b/ansi-tests/macro-function.lsp index aa6d7b5d703a533913a7e05da50d9695a177e90a..fe35a17854a0fb4e9d0fd5fa248613ba7a67fda9 100644 --- a/ansi-tests/macro-function.lsp +++ b/ansi-tests/macro-function.lsp @@ -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 diff --git a/ansi-tests/macroexpand-1.lsp b/ansi-tests/macroexpand-1.lsp index 0b4251a29a9800cc5d2ec92c2cceb922bdf9d705..3cac79bb9f787cd7be364b02f850d849f49288f5 100644 --- a/ansi-tests/macroexpand-1.lsp +++ b/ansi-tests/macroexpand-1.lsp @@ -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) diff --git a/ansi-tests/macroexpand.lsp b/ansi-tests/macroexpand.lsp index 956faec8a10713d3f91282239716b62d44d0aff2..c458f35d3a99254748eb00afaf500e1336a0467c 100644 --- a/ansi-tests/macroexpand.lsp +++ b/ansi-tests/macroexpand.lsp @@ -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)