From 19d2532a7920ab6da8b5f7977d4439fa0a198340 Mon Sep 17 00:00:00 2001 From: nobu Date: Fri, 19 Jun 2015 05:22:06 +0000 Subject: test_method.rb: split test * test/ruby/test_method.rb (test_define_singleton_method): split and fix test names. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50970 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/ruby/test_method.rb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/test/ruby/test_method.rb b/test/ruby/test_method.rb index 1cff8318ab..d54000d745 100644 --- a/test/ruby/test_method.rb +++ b/test/ruby/test_method.rb @@ -278,19 +278,24 @@ class TestMethod < Test::Unit::TestCase end end - def test_define_singleton_method + def test_define_method_no_proc o = Object.new def o.foo(c) c.class_eval { define_method(:foo) } end c = Class.new + assert_raise(ArgumentError) {o.foo(c)} o.foo(c) { :foo } assert_equal(:foo, c.new.foo) + end + def test_define_singleton_method o = Object.new o.instance_eval { define_singleton_method(:foo) { :foo } } assert_equal(:foo, o.foo) + end + def test_define_method_invalid_arg assert_raise(TypeError) do Class.new.class_eval { define_method(:foo, Object.new) } end -- cgit v1.2.3