aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--test/ruby/test_regexp.rb9
1 files changed, 6 insertions, 3 deletions
diff --git a/test/ruby/test_regexp.rb b/test/ruby/test_regexp.rb
index 2cd8e13352..1ef5bb2d1b 100644
--- a/test/ruby/test_regexp.rb
+++ b/test/ruby/test_regexp.rb
@@ -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 =~ ""