aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-11-16 05:25:53 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-11-16 05:25:53 +0000
commit22143c3883c90f0a7f4f11c59ac8f348af38a323 (patch)
tree758411a00b40447235ca8ad58613cbe48209ad1a
parent18b4a06cb46b9e0ae54097d7b940b1f2793b7a1b (diff)
downloadruby-22143c3883c90f0a7f4f11c59ac8f348af38a323.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
-rw-r--r--test/ruby/test_flip.rb21
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