summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-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