> On Feb 23, 2018, at 5:11 AM, 'Paulo Matos' via Racket Users 
> <racket-users@googlegroups.com> wrote:
> This fails because the i in the body of the test case does not exist at
> run-time. I understand why this is failing. However if I try to replace
> the i by #,(syntax->datum #'i) it also fails. My feeling is that I need
> to introduce a new template variable, which I would generally do with
> with-syntax however I am not sure how to integrate this with the
> for/list expression.

`i` is a compile-time value that you need to convert into a piece of syntax, so 
`syntax->datum` goes the wrong direction. You could use `datum->syntax`, or 
even just this:

#lang racket

(define-syntax (gen-testsuite stx)
  (syntax-case stx ()
    [(_ n)
        "Automated suite"
        #,@(for/list ([i (syntax->datum #'n)])
             (with-syntax ([i i])
                  (format "Test number ~a" i)
                  (check = i i)))))]))

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