aboutsummaryrefslogtreecommitdiffstats
path: root/test/ruby/test_method.rb
diff options
context:
space:
mode:
authorheadius <headius@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-01-06 20:56:49 +0000
committerheadius <headius@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-01-06 20:56:49 +0000
commitcd3bf49898c30975ec14df0ce9a9d01bb4f7d106 (patch)
tree8512ac36fc1f5800c8cf2b6f4940013858fb797a /test/ruby/test_method.rb
parentd50a8dd0bdf2e1638acb65255e312bb023b322ed (diff)
downloadruby-cd3bf49898c30975ec14df0ce9a9d01bb4f7d106.tar.gz
* test/ruby/test_method.rb: Add test for &-coersion of an
UnboundMethod. * test/ruby/test_module.rb: Add test for define_method given an UnboundMethod. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49164 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby/test_method.rb')
-rw-r--r--test/ruby/test_method.rb9
1 files changed, 9 insertions, 0 deletions
diff --git a/test/ruby/test_method.rb b/test/ruby/test_method.rb
index c8b5ff12d3..c88f3c88fe 100644
--- a/test/ruby/test_method.rb
+++ b/test/ruby/test_method.rb
@@ -652,6 +652,15 @@ class TestMethod < Test::Unit::TestCase
EOC
end
+ def test_unbound_method_proc_coerce
+ # '&' coercion of an UnboundMethod raises TypeError
+ assert_raise(TypeError) do
+ Class.new do
+ define_method('foo', &Object.instance_method(:to_s))
+ end
+ end
+ end
+
def test___dir__
assert_instance_of String, __dir__
assert_equal(File.dirname(File.realpath(__FILE__)), __dir__)