diff options
| author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-05-17 02:44:38 +0000 |
|---|---|---|
| committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-05-17 02:44:38 +0000 |
| commit | 093d264a0eefcd2ec0e969a17154c183cab3e2a1 (patch) | |
| tree | fd67b7fcd37f9c12e33cf55289f4a8e1083041e0 /test/ruby/test_eval.rb | |
| parent | baa7a556ba4ab4cef40d741bfe826102cf7e0533 (diff) | |
| download | ruby-093d264a0eefcd2ec0e969a17154c183cab3e2a1.tar.gz ruby-093d264a0eefcd2ec0e969a17154c183cab3e2a1.tar.xz ruby-093d264a0eefcd2ec0e969a17154c183cab3e2a1.zip | |
* test/ruby/test_eval.rb (test_define_method_block): new test
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@16441 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby/test_eval.rb')
| -rw-r--r-- | test/ruby/test_eval.rb | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/test/ruby/test_eval.rb b/test/ruby/test_eval.rb index 876aaafc0..c838141a1 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 |
