Skip to content

Commit

Permalink
test/runner.rb: Run tests only in test/unit and test/functional.
Browse files Browse the repository at this point in the history
  • Loading branch information
ngoto committed Nov 24, 2011
1 parent fb9ee40 commit 5371953
Showing 1 changed file with 16 additions and 6 deletions.
22 changes: 16 additions & 6 deletions test/runner.rb
Expand Up @@ -8,25 +8,35 @@
# libraries needed for the tests
require 'test/unit'

unit_test = File.join(File.dirname($0), "unit")
func_test = File.join(File.dirname($0), "functional")

if !defined?(Test::Unit::AutoRunner) then
# Ruby 1.9.1 does not have Test::Unit::AutoRunner
Test::Unit.setup_argv do |files|
[ File.dirname($0) ]
[ unit_test, func_test ]
end
# tests called when exiting the program

elsif defined?(Test::Unit::Color) then
# workaround for test-unit-2.0.x
r = Test::Unit::AutoRunner.new(true)
r.to_run.push File.dirname($0)
r.to_run.push unit_test
r.to_run.push func_test
r.process_args(ARGV)
exit r.run

elsif RUBY_VERSION > "1.8.2" then
r = Test::Unit::AutoRunner.new(true) do |ar|
ar.to_run.push unit_test
ar.to_run.push func_test
[ unit_test, func_test ]
end
r.process_args(ARGV)
exit r.run

elsif RUBY_VERSION > "1.8.2"
# current Test::Unit -- Ruby 1.8.3 or later
exit Test::Unit::AutoRunner.run(true, File.dirname($0))
else
# old Test::Unit -- Ruby 1.8.2 or older
exit Test::Unit::AutoRunner.run(false, File.dirname($0))
raise "Ruby version too old. Please use newer version of Ruby."
end

0 comments on commit 5371953

Please sign in to comment.