David Janke wrote at 06/05/2012 04:01 PM:
I'm curious what you all think about the new "test" submodule that allows inline unit tests...

I tried it out to confirm it did what I needed, and plan to start using it in real code as soon as we get closer to the next Racket release, which I believe will be later this summer. (Most of my code is written with the intention of eventually releasing as PLaneT packages, and I don't want to put anything in PlaneT that depends on a pre-release.)

At first glance, the test submodule sounds like a cool idea, because your tests can help document your functions.

Yes. I think it's also good for record-keeping of what is getting tested (i.e., if there are tests right by the procedure definition, you can immediately see that it is indeed being tested).

Perhaps most convenient is that, when you can also test definitions that are not "provide"d by the module. When I have tested some module-internal procedures directly in the past, I've usually ended up commenting-out the tests, or having them in a separate test file that no longer works. (I don't want to split up modules just for testing.) Now I can keep the tests of module-internal procedures as part of an automated regression test suite.

I also think that there is an even more useful application for submodules than inline testing: managing the module and phase spaghetti that one can encounter with syntax transformers that permit arbitrary code, like "syntax-case" and "syntax-parse". I have one package, for example, that requires I open 5 tabs in DrRacket every time I need to work on the package, and keep switching between the tabs. With submodules, all that code is getting shoved back into one much more manageable file.

Neil V.

____________________
 Racket Users list:
 http://lists.racket-lang.org/users

Reply via email to