The problem here is the same as in

 https://groups.google.com/d/msg/racket-users/H7vilh3KcD4/pGZif3F3dEkJ

I still haven't thought about it enough to fine better solution than
putting `require (only-in racket/base #%module-begin))` before the
submodule declaration.

At Thu, 30 Jul 2015 16:46:34 +0200, Konrad Hinsen wrote:
> Hi everyone,
> 
> I have been testing literate programming in Racket recently (#lang 
> scribble/lp2), and found it overall quite nice - until I wanted to 
> include tests in the usual way, by creating a submodule "test":
> 
> ==================================================
> #lang scribble/lp2
> 
> @chunk[<drop>
>         (define (drop t)
>           (* 1/2 9.8 t t))]
> 
> @chunk[<test-drop>
>         (check-= (drop 0) 0 ε)
>         (check-= (drop 10) 490 ε)]
> 
> @chunk[<to-energy>
>         (define (to-energy m)
>           (* m (expt 299792458.0 2)))]
> 
> @chunk[<test-to-energy>
>         (check-= (to-energy 0) 0 ε)
>         (check-= (to-energy 1) 9e+16 1e+15)]
> 
> @chunk[<*>
>         (provide drop to-energy)
>         <drop>
>         <to-energy>
>         (module* test #f
>           (require rackunit)
>           (define ε 1e-10)
>           <test-drop>
>           <test-to-energy>)]
> ==================================================
> 
> This is a straightforward conversion of a submodule example from the 
> Racket guide to #lang scribble/lp2. But it doesn't work, because the 
> bindings drop and to-energy are not visible inside the test submodule.
> 
> Given that scribble uses submodules itself, I am not sure if this is 
> supposed to work. What I am more interested in is finding a workaround. 
> Is there some way to combine literate programming and testing using 
> "raco test"?
> 
> Konrad.
> 
> -- 
> 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.

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