ruby-changes:34396
From: nobu <ko1@a...>
Date: Fri, 20 Jun 2014 15:47:41 +0900 (JST)
Subject: [ruby-changes:34396] nobu:r46477 (trunk): test_regexp.rb: split test_once
nobu 2014-06-20 15:47:37 +0900 (Fri, 20 Jun 2014) New Revision: 46477 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=46477 Log: test_regexp.rb: split test_once * test/ruby/test_regexp.rb (test_once): split for each cases than separating by comments. Modified files: trunk/test/ruby/test_regexp.rb Index: test/ruby/test_regexp.rb =================================================================== --- test/ruby/test_regexp.rb (revision 46476) +++ test/ruby/test_regexp.rb (revision 46477) @@ -1008,8 +1008,9 @@ class TestRegexp < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_regexp.rb#L1008 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 https://github.com/ruby/ruby/blob/trunk/test/ruby/test_regexp.rb#L1019 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 https://github.com/ruby/ruby/blob/trunk/test/ruby/test_regexp.rb#L1032 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 =~ "" -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/