Dave Thomas wrote: > On Nov 27, 2004, at 10:47, Florian Gross wrote: > >> I think this is too indirect. I'd really like to see the sample code >> inlined in the documentation, but formatted differently so it stands >> out. Being able to toggle the visibility of sample setup code would >> also be a nice thing, but it isn't as important to me. Of course this >> is just my personal opinion and other's are likely to have other >> thoughts about this. > > Are you talking about sample code or unit tests here. For sample code, I > don't see why you'd want to hide it--wouldn't it be part of the normal > comment of the method? I'm talking about cases where both are the same thing. (The overlap is really quite big. It works out well and lets you automatically keep the documentation and the code in synchronization. It offers quite some benefits to treat test and sample code as the same thing though it does not make sense for all test code to be used for samples.) However test code can sometimes need complex set-up code for which it could make sense to be hidden by default. I think a Ruby tutorial / book used the technique of providing samples and hiding the parts that were explained only in later chapters.