>
> Are there any advantages/disadvantages of using test submodules vs
> separate test files? Or is it just a matter of personal preference?
>
> It looks like that test submodules are more convenient and flexible but
> I observed that test submodules increase the start up time of racket
> scripts.
>

If you're using contracts, you want your tests to cross the contract
boundaries. If you attach your contracts at the module boundary (a common
practice), then submodule tests will not trigger the contracts. (Example
below.) So putting these tests in a separate file is the better option.

;;;;;
#lang racket

(define/contract (add1 x y)
  (integer? integer? . -> . integer?)
  (+ x y))

(provide (contract-out [add2 (integer? integer? . -> . integer?)]))
(define (add2 x y)
  (+ x y))

(module+ test
  (require rackunit)
  (check-exn exn:fail? (λ _ (add1 20.5 21.5)))
  (check-equal? (add2 20.5 21.5) 42.0)) ; surprise!
;;;;;

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