From: Christian Neukirchen Date: 2005-09-04T21:51:53+09:00 Subject: Re: Idea about Test::Unit gabriele renzi writes: > Christian Neukirchen ha scritto: > >> "Trans" writes: >> >>>I've gotten tired of this verbosity myself and have started playing >>>with: >>> >>> require 'quicktest' >>> >>> test :foo { >>> ... >>> } >> Truly amazing, I wrote *exactly* the same thing for myself. Except >> mine is called "quiktest" and the test name is optional (you need to >> use parens or do...end in above, btw). :-P >> > > quicktest seem to be a common name[1] :) > IIRC something like this was already planned from Nathaniel Talbott, > but I think that if you're writing a single test class per file even > the test{} could be avoided. quiktest was primarily made to add the tests in the same file as the library (they only get run with ruby -d). > [1] I wrote a "quicktest" thing too, but it was different, wrapping > sparse assertions in a test case to allow testing quick scripts like > this: > > def foo(x,y) > .. > end > assert_equal something, foo(2,3) Wrapping them with test{} doesn't hurt and you can reuse the file. Another idea is to do something like: def library end __END__ #!ruby load $0 assert_... and run that with ruby -x... -- Christian Neukirchen http://chneukirchen.org