summaryrefslogtreecommitdiff
path: root/test/ruby
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-04-22 03:20:14 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-04-22 03:20:14 +0000
commitd09363d8c9617d14cf39f7a45afcd497e315bd63 (patch)
treeed04e0e0bd41084261376aac2ab65543b14f7967 /test/ruby
parent4a9e4166bfe979539ad7f933b308db110c1ffb51 (diff)
* eval.c (proc_invoke): shares dmethod scope local variables.
a patch from coderrr at [ruby-core:23050] * gc.c (obj_free): do not free cloned scope local variables. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@23257 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby')
-rw-r--r--test/ruby/test_proc.rb10
1 files changed, 10 insertions, 0 deletions
diff --git a/test/ruby/test_proc.rb b/test/ruby/test_proc.rb
index 0ddc76a804..5436879041 100644
--- a/test/ruby/test_proc.rb
+++ b/test/ruby/test_proc.rb
@@ -91,4 +91,14 @@ class TestProc < Test::Unit::TestCase
assert_equal(10, Proc.new{|&b| b.call(10)}.call {|x| x})
assert_equal(12, Proc.new{|a,&b| b.call(a)}.call(12) {|x| x})
end
+
+ def test_define_method_scope
+ a = 1
+ c = Class.new
+ c.send(:define_method, :x) do |*|
+ lambda {a = 2}.call
+ end
+ c.new.x(nil)
+ assert_equal(2, a, '[ruby-core:23050]')
+ end
end