ruby-changes:38889
From: nobu <ko1@a...>
Date: Fri, 19 Jun 2015 14:22:31 +0900 (JST)
Subject: [ruby-changes:38889] nobu:r50970 (trunk): test_method.rb: split test
nobu 2015-06-19 14:22:06 +0900 (Fri, 19 Jun 2015) New Revision: 50970 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=50970 Log: test_method.rb: split test * test/ruby/test_method.rb (test_define_singleton_method): split and fix test names. Modified files: trunk/test/ruby/test_method.rb Index: test/ruby/test_method.rb =================================================================== --- test/ruby/test_method.rb (revision 50969) +++ test/ruby/test_method.rb (revision 50970) @@ -278,19 +278,24 @@ class TestMethod < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_method.rb#L278 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 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/