1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

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
This commit is contained in:
nobu 2016-11-16 05:25:53 +00:00
parent 558c362f60
commit 13969a2b5d

View file

@ -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