mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* lib/test/unit.rb: Add new class variable @@testfile_prefix
.
This is for changing test name prefix. (For testing) * test/testunit/tests_for_parallel/ptest_first.rb: Renamed from test_first.rb * test/testunit/tests_for_parallel/ptest_second.rb: Renamed from test_second.rb * test/testunit/tests_for_parallel/ptest_third.rb: Renamed from test_third.rb * test/testunit/tests_for_parallel/ptest_forth.rb: Renamed from test_forth.rb * test/testunit/tests_for_parallel/runner.rb: Remove misc.rb * test/testunit/tests_for_parallel/ptest_first.rb: ditto. * test/testunit/tests_for_parallel/ptest_second.rb: ditto. * test/testunit/tests_for_parallel/ptest_third.rb: ditto. * test/testunit/tests_for_parallel/ptest_forth.rb: ditto. * test/testunit/tests_for_parallel/misc.rb: Removed because no longer needed. * test/testunit/test_parallel.rb: Fix assertions for above. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32496 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
9cf9d5eaf7
commit
7506a580fe
12 changed files with 91 additions and 98 deletions
|
@ -1,36 +0,0 @@
|
|||
# FIXME: more portability code
|
||||
if caller(7) && /block in non_options/ =~ caller(7)[0]
|
||||
class TestCaseForParallelTest < Test::Unit::TestCase;end
|
||||
else
|
||||
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
|
||||
end
|
7
test/testunit/tests_for_parallel/ptest_first.rb
Normal file
7
test/testunit/tests_for_parallel/ptest_first.rb
Normal file
|
@ -0,0 +1,7 @@
|
|||
require 'test/unit'
|
||||
|
||||
class TestA < Test::Unit::TestCase
|
||||
def test_nothing_test
|
||||
end
|
||||
end
|
||||
|
16
test/testunit/tests_for_parallel/ptest_forth.rb
Normal file
16
test/testunit/tests_for_parallel/ptest_forth.rb
Normal file
|
@ -0,0 +1,16 @@
|
|||
require 'test/unit'
|
||||
|
||||
class TestE < Test::Unit::TestCase
|
||||
def test_not_fail
|
||||
assert_equal(1,1)
|
||||
end
|
||||
|
||||
def test_always_skip
|
||||
skip "always"
|
||||
end
|
||||
|
||||
def test_always_fail
|
||||
assert_equal(0,1)
|
||||
end
|
||||
end
|
||||
|
11
test/testunit/tests_for_parallel/ptest_second.rb
Normal file
11
test/testunit/tests_for_parallel/ptest_second.rb
Normal file
|
@ -0,0 +1,11 @@
|
|||
require 'test/unit'
|
||||
|
||||
class TestB < Test::Unit::TestCase
|
||||
def test_nothing
|
||||
end
|
||||
end
|
||||
|
||||
class TestC < Test::Unit::TestCase
|
||||
def test_nothing
|
||||
end
|
||||
end
|
|
@ -1,8 +1,7 @@
|
|||
require 'test/unit'
|
||||
require_relative "misc.rb"
|
||||
|
||||
class TestD < TestCaseForParallelTest
|
||||
def ptest_fail_at_worker
|
||||
class TestD < Test::Unit::TestCase
|
||||
def test_fail_at_worker
|
||||
#if /test\/unit\/parallel\.rb/ =~ $0
|
||||
if on_parallel_worker?
|
||||
assert_equal(0,1)
|
|
@ -1,7 +1,10 @@
|
|||
require 'rbconfig'
|
||||
require 'test/unit'
|
||||
require_relative 'misc'
|
||||
|
||||
src_testdir = File.dirname(File.expand_path(__FILE__))
|
||||
|
||||
class Test::Unit::Runner
|
||||
@@testfile_prefix = "ptest"
|
||||
end
|
||||
|
||||
exit Test::Unit::AutoRunner.run(true, src_testdir)
|
||||
|
|
|
@ -1,8 +0,0 @@
|
|||
require 'test/unit'
|
||||
require_relative "misc.rb"
|
||||
|
||||
class TestA < TestCaseForParallelTest
|
||||
def ptest_nothing_test
|
||||
end
|
||||
end
|
||||
|
|
@ -1,17 +0,0 @@
|
|||
require 'test/unit'
|
||||
require_relative "misc.rb"
|
||||
|
||||
class TestE < TestCaseForParallelTest
|
||||
def ptest_not_fail
|
||||
assert_equal(1,1)
|
||||
end
|
||||
|
||||
def ptest_always_skip
|
||||
skip "always"
|
||||
end
|
||||
|
||||
def ptest_always_fail
|
||||
assert_equal(0,1)
|
||||
end
|
||||
end
|
||||
|
|
@ -1,12 +0,0 @@
|
|||
require 'test/unit'
|
||||
require_relative "misc.rb"
|
||||
|
||||
class TestB < TestCaseForParallelTest
|
||||
def ptest_nothing
|
||||
end
|
||||
end
|
||||
|
||||
class TestC < TestCaseForParallelTest
|
||||
def ptest_nothing
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue