Sha256: 873e2f4db575e3f1a649c60d8a323341f9369c1ea4e6c2262ccb23fc2bb10bba

Contents?: true

Size: 763 Bytes

Versions: 1

Compression:

Stored size: 763 Bytes

Contents

# Christian Neukirchen

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

1 entries across 1 versions & 1 rubygems

Version Path
facets-0.9.0 lib/unit/quicktest.rb