Dave Thomas wrote: > > On Nov 25, 2004, at 15:32, benny wrote: > >> Now the idea: Why not use the examples in the unit-tests (at least the >> "positive ones") as link to a popup window "examples" in the >> HTML-documentation created by rdoc? > > I've been thinking a bit about this. I'm nervous about imposing my own > rules on how tests are organized and how methods are named: I'd like > RDoc to be as transparent as possible. > > So here's another take on it. You can already link from the method to > its test using standard RDoc hyperlinks. How about adding a slight bit > of new linking smarts: if you hyperlink to a class/method where the > class name starts Test and the method name starts test_, RDoc will > hyperlink to it in a different window. That way you can read the > mainline code, and scroll to the appropriate test in the test window by > clicking. You comment block might contain: > > # burble burble burble. Burble burble burble. Burble burble burble > # burble burble. See the unit test in TestThingie#test_create > > def create > ... > end > > It'll use a named window, so all test code will share just one > additional window. > > > Cheers > > Dave (hoping your still watching this thread) I find it a good idea. Maybe instead of worring about the best solution we should allow both: unit-test in the documentation and documentation in the unit-tests. your proposal has the advantage to be able to put some extra documentation about the given examples in this popup-window (and separate this from the main documentation, too). following your proposal the question arises how to mark the parts of the testing code that should be shown in the window / how to hide the preparation.(when I got you right, you thought, that we build the documentation also in the test-directory and link to it , but that would hide the concrete code, wouldn't it ? and writing the same code 2 times - for the comment block and the code itself is annoying) cheers, benny