mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* test/testunit/test_parallel.rb, test/testunit/parallel/*:
Test for r30939. * lib/test/unit.rb: For test. * lib/test/parallel.rb: For test. * lib/test/unit/testcase.rb: For test. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30947 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
92729ad473
commit
48fa6ed529
10 changed files with 283 additions and 3 deletions
31
test/testunit/tests_for_parallel/misc.rb
Normal file
31
test/testunit/tests_for_parallel/misc.rb
Normal file
|
@ -0,0 +1,31 @@
|
|||
module Test
|
||||
module Unit
|
||||
class Worker
|
||||
def run_tests
|
||||
_run_anything :ptest
|
||||
end
|
||||
end
|
||||
class Runner
|
||||
def run_tests
|
||||
_run_anything :ptest
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
module MiniTest
|
||||
class Unit
|
||||
class << TestCase
|
||||
alias ptest_suites test_suites
|
||||
def ptest_methods;[];end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
class TestCaseForParallelTest < Test::Unit::TestCase
|
||||
class << self
|
||||
undef ptest_methods
|
||||
def ptest_methods
|
||||
public_instance_methods(true).grep(/^ptest/).map { |m| m.to_s }
|
||||
end
|
||||
end
|
||||
end
|
7
test/testunit/tests_for_parallel/runner.rb
Normal file
7
test/testunit/tests_for_parallel/runner.rb
Normal file
|
@ -0,0 +1,7 @@
|
|||
require 'rbconfig'
|
||||
require 'test/unit'
|
||||
require_relative 'misc'
|
||||
|
||||
src_testdir = File.dirname(File.expand_path(__FILE__))
|
||||
|
||||
exit Test::Unit::AutoRunner.run(true, src_testdir)
|
8
test/testunit/tests_for_parallel/test_first.rb
Normal file
8
test/testunit/tests_for_parallel/test_first.rb
Normal file
|
@ -0,0 +1,8 @@
|
|||
require 'test/unit'
|
||||
require_relative "misc.rb"
|
||||
|
||||
class TestA < TestCaseForParallelTest
|
||||
def ptest_nothing_test
|
||||
end
|
||||
end
|
||||
|
17
test/testunit/tests_for_parallel/test_forth.rb
Normal file
17
test/testunit/tests_for_parallel/test_forth.rb
Normal file
|
@ -0,0 +1,17 @@
|
|||
require 'test/unit'
|
||||
require_relative "misc.rb"
|
||||
|
||||
class TestE < TestCaseForParallelTest
|
||||
def ptest_not_fail
|
||||
assert_equal(1,1)
|
||||
end
|
||||
|
||||
def ptest_always_skip
|
||||
skip
|
||||
end
|
||||
|
||||
def ptest_always_fail
|
||||
assert_equal(0,1)
|
||||
end
|
||||
end
|
||||
|
12
test/testunit/tests_for_parallel/test_second.rb
Normal file
12
test/testunit/tests_for_parallel/test_second.rb
Normal file
|
@ -0,0 +1,12 @@
|
|||
require 'test/unit'
|
||||
require_relative "misc.rb"
|
||||
|
||||
class TestB < TestCaseForParallelTest
|
||||
def ptest_nothing
|
||||
end
|
||||
end
|
||||
|
||||
class TestC < TestCaseForParallelTest
|
||||
def ptest_nothing
|
||||
end
|
||||
end
|
14
test/testunit/tests_for_parallel/test_third.rb
Normal file
14
test/testunit/tests_for_parallel/test_third.rb
Normal file
|
@ -0,0 +1,14 @@
|
|||
require 'test/unit'
|
||||
require_relative "misc.rb"
|
||||
|
||||
class TestD < TestCaseForParallelTest
|
||||
def ptest_sleeping
|
||||
sleep 2
|
||||
end
|
||||
|
||||
def ptest_fail_at_worker
|
||||
if MiniTest::Unit.output != STDOUT
|
||||
assert_equal(0,1)
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue