diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-11-16 05:25:53 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-11-16 05:25:53 +0000 |
commit | 13969a2b5dfc053ece8d1014d4aec544a5f313e0 (patch) | |
tree | 758411a00b40447235ca8ad58613cbe48209ad1a /test/ruby | |
parent | 558c362f607958d9e04346f3afda09461a135c32 (diff) | |
download | ruby-13969a2b5dfc053ece8d1014d4aec544a5f313e0.tar.gz |
test_flip.rb: r56316
* test/ruby/test_flip.rb (test_input_line_number_range): test for
r56316. [ruby-core:78162] [Bug #12947]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56811 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby')
-rw-r--r-- | test/ruby/test_flip.rb | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/test/ruby/test_flip.rb b/test/ruby/test_flip.rb index 810fd5d3ae..b8b05aed6d 100644 --- a/test/ruby/test_flip.rb +++ b/test/ruby/test_flip.rb @@ -50,4 +50,25 @@ class TestFlip < Test::Unit::TestCase 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 |