From: Florian Gross Date: 2004-10-14T10:29:36+09:00 Subject: Re: documentation as source Nathaniel Talbott wrote: > On Oct 12, 2004, at 07:39, Florian Gross wrote: >>> When test/unit2 appears, tests will become even more like documentation. >> I'm interested: What will it change? > Well, the current plan is to let you to do something like this: > > class Adder > include Testing > > # Adds two numbers > example { assert_equal(2, Adder.new.add(1, 1)) } > def add(a, b) > a + b > end > end > > Examples will then be collected and run as tests when you're in testing > mode, and (eventually) RDoc will understand the example blocks, so we > can get output like this: Ah, that looks very nifty. :) > add(a, b) > > Adds two numbers > > Adder.new.add(1, 1) => 2 > > I haven't yet had a chance to look through your test extractor (though I > was encouraged to pursue this idea by it), but from a cursory survey it > seems to take quite a different approach. Can you compare the approaches? Mine takes the RDoc style samples and converts it to a test-case and the above mentioned takes a short test case and converts it to sample code. I think we're doing the same, but from opposite ends. > HTH, > Nathaniel > Terralien, Inc. Regards, Florian Gross