From 8676f8baf2d41c8a630abfc9d1a64e564f35ea90 Mon Sep 17 00:00:00 2001 From: nobu Date: Sat, 17 May 2008 02:44:38 +0000 Subject: [PATCH] * test/ruby/test_eval.rb (test_define_method_block): new test git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16441 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/ruby/test_eval.rb | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/test/ruby/test_eval.rb b/test/ruby/test_eval.rb index 876aaafc08..c838141a18 100644 --- a/test/ruby/test_eval.rb +++ b/test/ruby/test_eval.rb @@ -358,6 +358,19 @@ class TestEval < Test::Unit::TestCase } end + def test_define_method_block + cc = Class.new do + define_method(:foo) {|&block| + block.call if block + } + end + + c = cc.new + x = "ng" + c.foo() {x = "ok"} + assert_equal("ok", x) + end + def test_eval_using_integer_as_binding assert_raise(TypeError) { eval("", 1) } end