From e4ff461d0f7266d860df0ec1152c185e99cf84b9 Mon Sep 17 00:00:00 2001 From: nobu Date: Sat, 19 Dec 2015 15:29:01 +0000 Subject: proc.c: fix infinite loop * proc.c (rb_proc_get_iseq): proc made from symbol does not have iseq. fix infinite loop. [ruby-core:72381] [Bug #11845] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53206 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/ruby/test_symbol.rb | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'test/ruby') diff --git a/test/ruby/test_symbol.rb b/test/ruby/test_symbol.rb index 94541865f2..8960bec0d1 100644 --- a/test/ruby/test_symbol.rb +++ b/test/ruby/test_symbol.rb @@ -164,6 +164,18 @@ class TestSymbol < Test::Unit::TestCase end; end + def test_to_proc_iseq + assert_separately([], <<~"end;", timeout: 1) # do + bug11845 = '[ruby-core:72381] [Bug #11845]' + assert_nil(:class.to_proc.source_location, bug11845) + assert_equal([[:rest]], :class.to_proc.parameters, bug11845) + c = Class.new {define_method(:klass, :class.to_proc)} + m = c.instance_method(:klass) + assert_nil(m.source_location, bug11845) + assert_equal([[:rest]], m.parameters, bug11845) + end; + end + def test_call o = Object.new def o.foo(x, y); x + y; end -- cgit v1.2.3