mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
test_regexp.rb: split test_once
* test/ruby/test_regexp.rb (test_once): split for each cases than separating by comments. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46477 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
f9a2d6b9d9
commit
90a9db6e6c
1 changed files with 6 additions and 3 deletions
|
@ -1008,8 +1008,9 @@ class TestRegexp < Test::Unit::TestCase
|
|||
assert_equal(/0/, pr1.call(0))
|
||||
assert_equal(/0/, pr1.call(1))
|
||||
assert_equal(/0/, pr1.call(2))
|
||||
end
|
||||
|
||||
# recursive
|
||||
def test_once_recursive
|
||||
pr2 = proc{|i|
|
||||
if i > 0
|
||||
/#{pr2.call(i-1).to_s}#{i}/
|
||||
|
@ -1018,8 +1019,9 @@ class TestRegexp < Test::Unit::TestCase
|
|||
end
|
||||
}
|
||||
assert_equal(/(?-mix:(?-mix:(?-mix:)1)2)3/, pr2.call(3))
|
||||
end
|
||||
|
||||
# multi-thread
|
||||
def test_once_multithread
|
||||
m = Mutex.new
|
||||
pr3 = proc{|i|
|
||||
/#{m.unlock; sleep 0.5; i}/o
|
||||
|
@ -1030,8 +1032,9 @@ class TestRegexp < Test::Unit::TestCase
|
|||
th2 = Thread.new{m.lock; ary << pr3.call(n+=1)}
|
||||
th1.join; th2.join
|
||||
assert_equal([/1/, /1/], ary)
|
||||
end
|
||||
|
||||
# escape
|
||||
def test_once_escape
|
||||
pr4 = proc{|i|
|
||||
catch(:xyzzy){
|
||||
/#{throw :xyzzy, i}/o =~ ""
|
||||
|
|
Loading…
Add table
Reference in a new issue