> #lang racket/base
> (define f (λ _ (error 'FAIL)))
> (module+ test
>   (require rackunit)
>   (define OK (string->unreadable-symbol "OK"))
>   (define-syntax-rule (check-OK-form expr)
>     (let ([val expr])
>       (with-check-info (['input 'expr] ['expected OK] ['actual val])
>         (check eq? val OK))))
>   (check-OK-form OK)
>   *(check-OK-form (values #f))*
>   (check-OK-form (f)))
>
> Even without a C-u prefix, the input can help locate the offending check:
>
> --------------------
> ; FAILURE
> ; /tmp/somefile.rkt:9:8
> input:      (values #f)
> expected:   OK
> actual:     #f
> name:       check
> location:   somefile.rkt:9:8
> --------------------
> ; error: FAIL
> ; Context:
> ;  (submod "/tmp/somefile.rkt" test):1:1 [running body]
>

Argh, I was too hasty to declare the with-check-info the winner here. Note 
that you get this extra info when the check actually fails, in your example 
above the (values #f) case fails, note the next one that calls (f) that 
throws. In this latter case the stack is nowhere to be found and no extra 
check info is present, so you are essentially back to square one, sigh. Now 
this really bothers me cause all of my tests turn into a black box that I 
need to poke and prod whenever something breaks.

-- 
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