We've talked before about having a testing mode so that tests could be written inline, but not run when the module is normally run. I've attached a patch that adds a simple way of doing this.
racket/test gives you - with-testing - with-deploying The first is a block of testing code. The second is a block of deployment code. The first never runs normally, but only runs when testing. The second always runs normally, but never runs during testing. (The second is to do stuff like parsing command line arguments or opening GUI windows, Web servers, etc.) I would expect that some would want Rackunit to always wrap its tests in testing mode, but I didn't include that. It also adds "raco test" which runs a file in testing mode. You can optionally add the "--all" option so that all dynamically required modules are run in testing mode as well. There could also be a testing button in DrRacket, but I didn't include that. I think this is nice and a bare minimum that solves the problem. Any thoughts? Jay Here's a little interaction: ~plt/collects/tests/racket/testing % racket c.rkt c running! ~plt/collects/tests/racket/testing % racket b.rkt c running! b running! ~plt/collects/tests/racket/testing % racket a.rkt c running! b running! a running! ~plt/collects/tests/racket/testing % raco test a.rkt 1 test passed ~plt/collects/tests/racket/testing % raco test --all a.rkt 1 test passed 1 test passed 1 test passed ~plt/collects/tests/racket/testing % -- Jay McCarthy <j...@cs.byu.edu> Assistant Professor / Brigham Young University http://faculty.cs.byu.edu/~jay "The glory of God is Intelligence" - D&C 93
0001-Adding-a-simple-testing-mode-library.patch
Description: Binary data
_________________________________________________ For list-related administrative tasks: http://lists.racket-lang.org/listinfo/dev