hyper-literate/test/test.hl.rkt
2016-06-17 18:23:53 +02:00

65 lines
1.5 KiB
Racket

#lang hyper-literate/typed typed/racket/base
@(require (for-label typed/racket/base))
@title{Title}
Hello world.
@(if-preexpanding
(void)
(require (submod "..")))
@(unless-preexpanding
(symbol->string ee))
Submodules work:
@chunk[<submod>
(module ms typed/racket/base
(define x 1)
(provide x))
(module ms2 typed/racket/base
(define y -1)
(provide y))]
And can be required:
@chunk[<submod>
(require 'ms)
(require (submod "." ms2))]
Submodules with @racket[module*] work too:
@chunk[<submod*>
(module* ms* racket/base
(require typed/rackunit)
<req-dotdot>
(check-equal? ee 'e123)
(check-equal? y -1))]
And so does @racket[(require (submod ".." ))]:
@chunk[<req-dotdot>
(require (submod ".."))
(require (submod ".." ms2))]
@chunk[<*>
(begin
;; Wrap the require in a `(begin …)` so that it gets ignored,
;; otherwise scribble complains some identifiers are loaded twice
;; for-label.
(require (for-syntax)))
(require typed/rackunit)
<submod>
(check-equal? (+ x x) 2)
(check-equal? (+ x y) 0)
;; Gives an error because typed/racket/base is used on the #lang line:
;curry
(check-equal? ((make-predicate One) 1) #t)
(check-equal? (ann 'sym Symbol) 'sym)
(define (f [x : 'e123]) x)
(define ee (ann (f 'e123) 'e123))
(provide ee)]