Skip to content

Instantly share code, notes, and snippets.

@rebcabin
Last active December 14, 2015 18:46
Show Gist options
  • Select an option

  • Save rebcabin/0c550e2373f4f7e3f65c to your computer and use it in GitHub Desktop.

Select an option

Save rebcabin/0c550e2373f4f7e3f65c to your computer and use it in GitHub Desktop.
gensymming functions versus lisp-unit tests
(defpackage :io.github.rebcabin.temporary
(:use :common-lisp)
(:use :lisp-unit)
#+sbcl (:use :sb-ext))
(in-package :io.github.rebcabin.temporary)
;;; I can definitely define a function with a gensymmed name:
(defmacro m1 ()
(let ((g (gensym)))
`(progn
(defun ,g ()
(format t "my name is ~A~%" ',g))
(,g))))
(m1)
;;; I can definitely run tests via lisp-unit:
(define-test dt
(assert-true t))
;;; I can definitely NOT define a test using a gensymmed name. This compiles,
;;; but the test does not run.
(defmacro m2 ()
(let ((g (gensym)))
`(progn
(define-test ,g
(format t "my name is ~A~%" ',g))
)))
(m2)
(setf *print-failures* t)
(run-tests :all)
@rebcabin
Copy link
Copy Markdown
Author

Try to run this file by just loading it in a session with SBCL.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment