From: Christian Neukirchen Date: 2005-09-09T00:38:14+09:00 Subject: Re: Idea about Test::Unit "Trans" writes: > Christian Neukirchen wrote: > >> 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 >> >> >> require 'test/unit' >> >> $TGEN = "000000" >> >> def test(name=nil, &block) >> @@test ||= Class.new(Test::Unit::TestCase) >> @@test.__send__(:define_method, "test_#{name.to_s || $TGEN.succ!}", &block) >> end >> >> Test::Unit.run = !$DEBUG > > Thanks for this, I had been "playing" and hadn't yet coded it. So yours > came in very handy :-). It has two bugs though. 1) The #to_s on name > must go. And 2) using the -d option causes Test::Unit to alos dump it's > debug info too. Not good (It'd be nice if we had some sort of debug > level system, perhaps based on module nesting levels.) You're right, the code doesn't work at all. :-P It was just a quick hack, and I must have kept the wrong version. Feel free to take it, however, and make something useful. > Thanks again, > T. -- Christian Neukirchen http://chneukirchen.org