summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-06-19 05:22:06 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-06-19 05:22:06 +0000
commit19d2532a7920ab6da8b5f7977d4439fa0a198340 (patch)
tree10302bae185da21137e50e003e3af6dd3167a6b1
parent0ba2ccc51d2d9f09f78ba6094ca44acea5c327bf (diff)
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
-rw-r--r--test/ruby/test_method.rb7
1 files changed, 6 insertions, 1 deletions
diff --git a/test/ruby/test_method.rb b/test/ruby/test_method.rb
index 1cff831..d54000d 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