diff options
author | nahi <nahi@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2003-09-05 01:47:41 +0000 |
---|---|---|
committer | nahi <nahi@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2003-09-05 01:47:41 +0000 |
commit | e45738a2976eed3ff291ec075606f64baa3198cb (patch) | |
tree | 449b2a00c68622d658d9171021ef833720c924f8 | |
parent | af49aecff16d6969551eec0072e0713702aac18f (diff) |
* test/runner.rb: added. gets testcases from command line and runs it.
* test/ruby/test_gc.rb: remove useless part which was for dumping test result.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4503 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | ChangeLog | 7 | ||||
-rw-r--r-- | test/ruby/test_gc.rb | 6 | ||||
-rw-r--r-- | test/runner.rb | 42 |
3 files changed, 49 insertions, 6 deletions
@@ -1,3 +1,10 @@ +Fri Sep 5 10:42:58 2003 NAKAMURA, Hiroshi <nahi@ruby-lang.org> + + * test/runner.rb: added. gets testcases from command line and runs it. + + * test/ruby/test_gc.rb: remove useless part which was for dumping test + result. + Fri Sep 5 09:28:59 2003 NAKAMURA, Hiroshi <nahi@ruby-lang.org> * test/ruby/test_gc.rb: added. splitter.rb which I made to split diff --git a/test/ruby/test_gc.rb b/test/ruby/test_gc.rb index b513e44dc6..b55c391802 100644 --- a/test/ruby/test_gc.rb +++ b/test/ruby/test_gc.rb @@ -31,11 +31,5 @@ class TestGc < Test::Unit::TestCase } GC.start assert true # reach here or dumps core - - if $failed > 0 - printf "test: %d failed %d\n", $ntest, $failed - else - printf "end of test(test: %d)\n", $ntest - end end end diff --git a/test/runner.rb b/test/runner.rb new file mode 100644 index 0000000000..bae7116ea8 --- /dev/null +++ b/test/runner.rb @@ -0,0 +1,42 @@ +require 'test/unit/testsuite' +require 'test/unit/testcase' +require 'optparse' + +runner = 'console' +opt = OptionParser.new +opt.on("--runner=console", String) do |arg| + runner = arg +end +opt.parse!(ARGV) + +ARGV.each do |tc_name| + require tc_name +end + +class BulkTestSuite < Test::Unit::TestSuite + def self.suite + suite = Test::Unit::TestSuite.new + ObjectSpace.each_object(Class) do |klass| + suite << klass.suite if (Test::Unit::TestCase > klass) + end + suite + end +end + +runners_map = { + 'console' => proc do |suite| + require 'test/unit/ui/console/testrunner' + passed = Test::Unit::UI::Console::TestRunner.run(suite).passed? + exit(passed ? 0 : 1) + end, + 'gtk' => proc do |suite| + require 'test/unit/ui/gtk/testrunner' + Test::Unit::UI::GTK::TestRunner.run(suite) + end, + 'fox' => proc do |suite| + require 'test/unit/ui/fox/testrunner' + Test::Unit::UI::Fox::TestRunner.run(suite) + end, +} + +runners_map[runner].call(BulkTestSuite.suite) |