ruby-changes:4948
From: ko1@a...
Date: Sat, 17 May 2008 11:44:44 +0900 (JST)
Subject: [ruby-changes:4948] nobu - Ruby:r16441 (trunk): * test/ruby/test_eval.rb (test_define_method_block): new test
nobu 2008-05-17 11:44:38 +0900 (Sat, 17 May 2008) New Revision: 16441 Modified files: trunk/test/ruby/test_eval.rb Log: * test/ruby/test_eval.rb (test_define_method_block): new test http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/test/ruby/test_eval.rb?r1=16441&r2=16440&diff_format=u Index: test/ruby/test_eval.rb =================================================================== --- test/ruby/test_eval.rb (revision 16440) +++ test/ruby/test_eval.rb (revision 16441) @@ -358,6 +358,19 @@ } 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 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/