From: Trans Date: 2005-09-08T13:41:31+09:00 Subject: Re: Idea about Test::Unit 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.) Thanks again, T.