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
This commit is contained in:
parent
0ba2ccc51d
commit
19d2532a79
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user