diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-06-19 05:53:41 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-06-19 05:53:41 +0000 |
commit | e77f9fcb13a157c2478a0e78cdb0b9696e8ded8c (patch) | |
tree | 146acf56d92ac965489f640dcadefb33c6f05124 /test | |
parent | 19d2532a7920ab6da8b5f7977d4439fa0a198340 (diff) | |
download | ruby-e77f9fcb13a157c2478a0e78cdb0b9696e8ded8c.tar.gz |
proc.c: ArgumentError if no block
* proc.c (rb_mod_define_method): now requires a block direct to
this method call. [ruby-core:69655] [Bug #11283]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50971 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r-- | test/ruby/test_method.rb | 17 |
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) } |