summaryrefslogtreecommitdiff
path: root/test/ruby/test_method.rb
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-01-10 05:32:59 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-01-10 05:32:59 +0000
commitfd7c5303eb7b8c597d51b9d816cecee65a99968f (patch)
treee19d9da8a9eaabb1c975923fb04ec6100e64760d /test/ruby/test_method.rb
parent594793f588f60d143a4d462edecd8193edf5a3d0 (diff)
* 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
Diffstat (limited to 'test/ruby/test_method.rb')
-rw-r--r--test/ruby/test_method.rb8
1 files changed, 8 insertions, 0 deletions
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