I often end up writing macros that both quote some code and expand into that code where the first one is usually via `racket` or one of the code-rendering libraries, and the second one gets used to write tests for the code in my slideshow. These tend to be short and fairly ad hoc macros because I end up customizing them in various ways to support the presentation. I haven't found an idea for a nice general purpose library that does this. In the meantime, there's a bare bones example below. I usually end up starting like that but then doing various fancy things to support the specific examples in good ways.
hth,
Robby
#lang racket
(require slideshow
slideshow/code
syntax/parse/define)
(module+ test (require rackunit))
(define-simple-macro
(code+run e)
(values (code e) e))
(define-values (x^2+1-pict x^2+1-func)
(code+run
(λ (x)
(+ (* x x)
1))))
(module+ test
(check-equal? (x^2+1-func 0) 1)
(check-equal? (x^2+1-func -1) 2))
(slide x^2+1-pict)