aboutsummaryrefslogtreecommitdiffstats
path: root/test/ruby/test_method.rb
diff options
context:
space:
mode:
Diffstat (limited to 'test/ruby/test_method.rb')
-rw-r--r--test/ruby/test_method.rb17
1 files changed, 15 insertions, 2 deletions
diff --git a/test/ruby/test_method.rb b/test/ruby/test_method.rb
index d54000d745..911896d0b0 100644
--- a/test/ruby/test_method.rb
+++ b/test/ruby/test_method.rb
@@ -285,8 +285,9 @@ class TestMethod < Test::Unit::TestCase
end
c = Class.new
assert_raise(ArgumentError) {o.foo(c)}
- o.foo(c) { :foo }
- assert_equal(:foo, c.new.foo)
+
+ bug11283 = '[ruby-core:69655] [Bug #11283]'
+ assert_raise(ArgumentError, bug11283) {o.foo(c) {:foo}}
end
def test_define_singleton_method
@@ -295,6 +296,18 @@ class TestMethod < Test::Unit::TestCase
assert_equal(:foo, o.foo)
end
+ def test_define_singleton_method_no_proc
+ assert_raise(ArgumentError) {
+ o.instance_eval { define_singleton_method(:bar) }
+ }
+
+ bug11283 = '[ruby-core:69655] [Bug #11283]'
+ def o.define(n)
+ define_singleton_method(n)
+ end
+ assert_raise(ArgumentError) {o.define(:bar) {:bar}}
+ end
+
def test_define_method_invalid_arg
assert_raise(TypeError) do
Class.new.class_eval { define_method(:foo, Object.new) }