From: Nikodemus Siivola Date: 2002-05-20T22:30:04+09:00 Subject: Re: [RDoc etc] automatic documentation: using tests in addition to / instead of comments On Mon, 20 May 2002, Dave Thomas wrote: *snippage* > When run with ruby -rtest ..., the test cases get run. When rdoc'd, > the test code gets extracted and used as class-level documentation. > > I'm still not sure about this - what do folks think? At first blush I like it. It makes testing even more lightweigh and integrated, which is a good thing (tm). There are propably some gotchas there, but still. Trying to think of bad things: - Separation of code and tests has positive effects as well: an increased conceptual distance decreases the likelihood of making the same error in both tests and code. - Separation of code and tests is IMHO somewhat analogous to separation of interface and implementation. Having tests and coded interleaved might make you think of implementation when you should be thinking of interface. Still. I like it. Especially if you manage to have -rtest also automatically generate the docs for ri... ;) -- Nikodemus