From 787cdae5df0c7f5b09c9581702334f8f4029b3c1 Mon Sep 17 00:00:00 2001 From: nobu Date: Tue, 30 Apr 2013 03:31:43 +0000 Subject: proc.c: frozen core methods * proc.c (mproc, mlambda): use frozen core methods instead of plain global methods, so that methods cannot be overridden. [ruby-core:54687] [Bug #8345] * vm.c (Init_VM): define proc and lambda on the frozen core object. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40528 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/ruby/test_proc.rb | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'test/ruby/test_proc.rb') diff --git a/test/ruby/test_proc.rb b/test/ruby/test_proc.rb index dc426ddda5..a8933b0c76 100644 --- a/test/ruby/test_proc.rb +++ b/test/ruby/test_proc.rb @@ -1,4 +1,5 @@ require 'test/unit' +require_relative 'envutil' class TestProc < Test::Unit::TestCase def setup @@ -1157,4 +1158,14 @@ class TestProc < Test::Unit::TestCase assert_equal('zot', o.method(:foo).to_proc.() {'zot'}, bug3792) } end + + def test_overriden_lambda + bug8345 = '[ruby-core:54687] [Bug #8345]' + assert_normal_exit('def lambda; end; method(:puts).to_proc', bug8345) + end + + def test_overriden_proc + bug8345 = '[ruby-core:54688] [Bug #8345]' + assert_normal_exit('def proc; end; ->{}.curry', bug8345) + end end -- cgit v1.2.3