X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=tests%2Fmacroexpand.impure.lisp;fp=tests%2Fmacroexpand.impure.lisp;h=6f5863d4ed31a825d00a4043faa40f44a5779f29;hb=65e947c7a90df88e0691e664f3387ccb35d390d9;hp=0000000000000000000000000000000000000000;hpb=64d420902d31cb87ea752f09b314e4767816a9c9;p=sbcl.git diff --git a/tests/macroexpand.impure.lisp b/tests/macroexpand.impure.lisp new file mode 100644 index 0000000..6f5863d --- /dev/null +++ b/tests/macroexpand.impure.lisp @@ -0,0 +1,29 @@ +;;;; This file is for macroexpander tests which have side effects + +;;;; This software is part of the SBCL system. See the README file for +;;;; more information. +;;;; +;;;; While most of SBCL is derived from the CMU CL system, the test +;;;; files (like this one) were written from scratch after the fork +;;;; from CMU CL. +;;;; +;;;; This software is in the public domain and is provided with +;;;; absolutely no warranty. See the COPYING and CREDITS files for +;;;; more information. + +;;; From Matthew Swank on cll 2005-10-06 + +(defmacro defglobal (name &optional value) + (let ((internal (gensym))) + `(progn + (defparameter ,internal ,value) + (define-symbol-macro ,name ,internal)))) + +(defglobal glob) + +(assert (= (let ((glob 4)) glob))) +(assert (null glob)) +(assert (equal (let ((glob nil)) (setf glob (cons 'foo glob)) glob) '(foo))) +(assert (null glob)) +(assert (equal (let ((glob nil)) (push 'foo glob) glob) '(foo))) +(assert (null glob))