ruby-changes:44738
From: nobu <ko1@a...>
Date: Wed, 16 Nov 2016 14:25:59 +0900 (JST)
Subject: [ruby-changes:44738] nobu:r56811 (trunk): test_flip.rb: r56316
nobu 2016-11-16 14:25:53 +0900 (Wed, 16 Nov 2016) New Revision: 56811 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=56811 Log: test_flip.rb: r56316 * test/ruby/test_flip.rb (test_input_line_number_range): test for r56316. [ruby-core:78162] [Bug #12947] Modified files: trunk/test/ruby/test_flip.rb Index: test/ruby/test_flip.rb =================================================================== --- test/ruby/test_flip.rb (revision 56810) +++ test/ruby/test_flip.rb (revision 56811) @@ -50,4 +50,25 @@ class TestFlip < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_flip.rb#L50 assert_equal(expected, v1, mesg) assert_equal(expected, v2, mesg) end + + def test_input_line_number_range + bug12947 = '[ruby-core:78162] [Bug #12947]' + ary = b1 = b2 = nil + EnvUtil.suppress_warning do + b1 = eval("proc {|i| i if 2..4}") + b2 = eval("proc {|i| if 2..4; i; end}") + end + IO.pipe {|r, w| + th = Thread.start {(1..5).each {|i| w.puts i};w.close} + ary = r.map {|i| b1.call(i.chomp)} + th.join + } + assert_equal([nil, "2", "3", "4", nil], ary, bug12947) + IO.pipe {|r, w| + th = Thread.start {(1..5).each {|i| w.puts i};w.close} + ary = r.map {|i| b2.call(i.chomp)} + th.join + } + assert_equal([nil, "2", "3", "4", nil], ary, bug12947) + end end -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/