Sha256: 04399ec15a99f54c335793be20ddb20c2dd2622b74dd598f0db22d3861b410f3
Contents?: true
Size: 1.03 KB
Versions: 5
Compression:
Stored size: 1.03 KB
Contents
# Christian Neukirchen # This could actually be quite usable if it weren't for one small problem: # There is no way to close off blocks from the outside scope. # This can cause interferance between separate tests. # So while quicktest works for simple cases, it may well run into # problems with anything sizable. require 'test/unit' $TCGEN = "000000" $TGEN = "000000" #$TS = [] $TC = [nil] def testcase(name=nil, &block) tc = Class.new(Test::Unit::TestCase) #self.class.const_set("TC_#{(name||$TCGEN.succ!)}", tc) $TC << tc tc.class_eval &block end class Test::Unit::TestCase def self.gen_test_name @gen_test_name ||= "000000" @gen_test_name.succ! return "#{@gen_test_name}" end def self.test(name=nil, &block) __send__(:define_method, "test_#{(name||gen_test_name)}", &block) end end def test(name=nil, &block) $TC[0] ||= Class.new(Test::Unit::TestCase) self.class.const_set("TC#{$TCGEN.succ!}", $TC[0]) $TC[0].__send__(:define_method, "test_#{(name||$TGEN.succ!)}", &block) end #Test::Unit.run = !$DEBUG
Version data entries
5 entries across 5 versions & 2 rubygems
Version | Path |
---|---|
TwP-turn-0.5.1 | work/quicktest.rb |
TwP-turn-0.6.0 | work/quicktest.rb |
turn-0.6.0 | work/quicktest.rb |
turn-0.5.1 | work/quicktest.rb |
turn-0.4.0 | work/quicktest.rb |