first spike on ruby 1.9 w/ minitest
This commit is contained in:
parent
baa666610e
commit
825368a7ec
@ -1,6 +1,15 @@
|
|||||||
require 'test/unit'
|
require 'minitest/unit'
|
||||||
require 'test/unit/testresult'
|
require 'test/unit/assertions'
|
||||||
Test::Unit.run = true
|
#require 'test/unit/testresult'
|
||||||
|
#Test::Unit.run = true
|
||||||
|
module MiniTest
|
||||||
|
class Unit
|
||||||
|
def run(args)
|
||||||
|
puts 'not running!'
|
||||||
|
return 0
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
module Hydra #:nodoc:
|
module Hydra #:nodoc:
|
||||||
# Hydra class responsible for running test files.
|
# Hydra class responsible for running test files.
|
||||||
@ -54,6 +63,10 @@ module Hydra #:nodoc:
|
|||||||
@running = false
|
@running = false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def puke(klass, name, exception)
|
||||||
|
puts "puke! #{klass}, #{name}, #{exception}"
|
||||||
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
# The runner will continually read messages and handle them.
|
# The runner will continually read messages and handle them.
|
||||||
@ -77,6 +90,7 @@ module Hydra #:nodoc:
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
# Run all the Test::Unit Suites in a ruby file
|
# Run all the Test::Unit Suites in a ruby file
|
||||||
def run_test_unit_file(file)
|
def run_test_unit_file(file)
|
||||||
begin
|
begin
|
||||||
@ -86,14 +100,26 @@ module Hydra #:nodoc:
|
|||||||
return ex.to_s
|
return ex.to_s
|
||||||
end
|
end
|
||||||
output = []
|
output = []
|
||||||
@result = Test::Unit::TestResult.new
|
# @result = Test::Unit::TestResult.new
|
||||||
@result.add_listener(Test::Unit::TestResult::FAULT) do |value|
|
# @result.add_listener(Test::Unit::TestResult::FAULT) do |value|
|
||||||
output << value
|
# output << value
|
||||||
end
|
# end
|
||||||
|
|
||||||
|
|
||||||
klasses = Runner.find_classes_in_file(file)
|
klasses = Runner.find_classes_in_file(file)
|
||||||
|
puts "Klasses: #{klasses.inspect}"
|
||||||
begin
|
begin
|
||||||
klasses.each{|klass| klass.suite.run(@result){|status, name| ;}}
|
klasses.each{|klass|
|
||||||
|
#klass.suite.run(@result){|status, name| ;}
|
||||||
|
klass.test_suites.each do |suite|
|
||||||
|
suite.test_methods.each do |test|
|
||||||
|
inst = suite.new(test)
|
||||||
|
inst._assertions = 0
|
||||||
|
result = inst.run(self)
|
||||||
|
#puts result
|
||||||
|
end
|
||||||
|
end
|
||||||
|
}
|
||||||
rescue => ex
|
rescue => ex
|
||||||
output << ex.to_s
|
output << ex.to_s
|
||||||
end
|
end
|
||||||
@ -196,7 +222,11 @@ module Hydra #:nodoc:
|
|||||||
nil
|
nil
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
return klasses.select{|k| k.respond_to? 'suite'}
|
puts "Pre klasses: #{klasses.inspect}"
|
||||||
|
puts klasses
|
||||||
|
|
||||||
|
|
||||||
|
return klasses.select{|k| k.respond_to? 'test_suites'}
|
||||||
end
|
end
|
||||||
|
|
||||||
# Yanked a method from Cucumber
|
# Yanked a method from Cucumber
|
||||||
|
Loading…
Reference in New Issue
Block a user