From fd7c5303eb7b8c597d51b9d816cecee65a99968f Mon Sep 17 00:00:00 2001 From: nobu Date: Mon, 10 Jan 2011 05:32:59 +0000 Subject: [PATCH] * test/ruby/test_method.rb (TestMethod#test_define_method): method transplanting between class and module is impossible. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30506 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 5 +++++ test/ruby/test_method.rb | 8 ++++++++ 2 files changed, 13 insertions(+) diff --git a/ChangeLog b/ChangeLog index f695357b8e..34f1dc41da 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Mon Jan 10 14:32:55 2011 Nobuyoshi Nakada + + * test/ruby/test_method.rb (TestMethod#test_define_method): method + transplanting between class and module is impossible. + Mon Jan 10 13:51:17 2011 Nobuyoshi Nakada * misc/rdoc-mode.el (rdoc-mode): show trailing whitespace. diff --git a/test/ruby/test_method.rb b/test/ruby/test_method.rb index da17ef5e9c..fa5f9988f5 100644 --- a/test/ruby/test_method.rb +++ b/test/ruby/test_method.rb @@ -197,6 +197,14 @@ class TestMethod < Test::Unit::TestCase assert_raise(TypeError) do Class.new.class_eval { define_method(:foo, Object.new) } end + + assert_raise(TypeError) do + Module.new.module_eval {define_method(:foo, Base.instance_method(:foo))} + end + + assert_raise(TypeError) do + Class.new.class_eval {define_method(:meth, M.instance_method(:meth))} + end end def test_clone