I'm trying to create a way to automatically turn test cases into examples. I'd 
like a macro that turns this:

(extract-expressions
 (module+ test
   (check-equal? (extract-expression (square 5)) 25)
   (check-equal? (extract-expression (square -5)) 25))
 (module+ doc
   @defproc[(square [x real?]) real?]{
     Returns the square of @racket[x], the result of
     multiplying @racket[x] by itself.
     @examples[#:eval evaluator (include-extracted-expressions)]}))

into this:

(begin
  (module+ test
    (check-equal? (square 5) 25))
  (module+ doc
    @defproc[(square [x real?]) real?]{
      Returns the square of @racket[x], the result of
      multiplying @racket[x] by itself.
      @examples[#:eval evaluator (square 5) (square -5)]}))

That's the general idea anyway. I want to be able to gather arbitrary 
expressions inside a region and "copy" them into some other marked place inside 
the expressions. How exactly do I go about doing this, and how should I do it 
"properly"?

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to