I have the following scribble module (in /tmp/tim.rkt)

#lang scribble/lp
@(chunk
  <*>
  (module m racket
    (provide x)
    (define x 22))

  (module test racket
    (require rackunit)
    (require (submod ".." m))
    (check-equal? 32 x)))

When I run it in DrRacket (with require test module) or run
"raco test /tmp/tim.rkt" the unit test fails.

I can only import the functionality of this module, however with:
  (require (submod (file "/tmp/tim.rkt") m))

If I pull the provide and define of x up into the top-level module:

#lang scribble/lp
@(chunk
  <*>
  (module m racket
    (provide x)
    (define x 22))

  (module+ test
    (require rackunit)
    ;(require (submod ".." m))
    (check-equal? 32 x))

  (module test2 racket
    (require rackunit)
    ;(require (submod ".." m))
    (check-equal? 32 x)))

Both both test and test2 complain about:

  x: unbound identifier in module in: x

What is the correct pattern for writing unit tests in scribble/lp
modules (basically so I can "raco test" all my .rkt files)?

· Am I just /missing something/ as per usual?
· Should I use the first style, and re-export m through a second file?

Tim

--
Tim Brown CEng MBCS <[email protected]>
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
                City Computing Limited · www.cityc.co.uk
      City House · Sutton Park Rd · Sutton · Surrey · SM1 2AE · GB
                T:+44 20 8770 2110 · F:+44 20 8770 2130
────────────────────────────────────────────────────────────────────────
City Computing Limited registered in London No:1767817.
Registered Office: City House, Sutton Park Road, Sutton, Surrey, SM1 2AE
VAT No: GB 918 4680 96

--
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 [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to