aboutsummaryrefslogtreecommitdiffstats
path: root/test/ruby/test_module.rb
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-10-26 13:43:19 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-10-26 13:43:19 +0000
commit0a74709e1a9d545c7f637df7704618c596a9bc6e (patch)
tree4bcaa46bf6cf4ba0fa4d4ac443e5b01f54be735d /test/ruby/test_module.rb
parent4a6dff84f03df9e07c65bce31e0eebd6dbbfc892 (diff)
downloadruby-0a74709e1a9d545c7f637df7704618c596a9bc6e.tar.gz
Add string argument test cases
* test/ruby/test_module.rb (test_method_defined): Add test cases for `public/protected/private _method_defined?` These methods accept string as argument, so add string argument cases. [Fix GH-1067] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52290 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby/test_module.rb')
-rw-r--r--test/ruby/test_module.rb15
1 files changed, 15 insertions, 0 deletions
diff --git a/test/ruby/test_module.rb b/test/ruby/test_module.rb
index 9b5cbfee88..ed052ff711 100644
--- a/test/ruby/test_module.rb
+++ b/test/ruby/test_module.rb
@@ -964,13 +964,28 @@ class TestModule < Test::Unit::TestCase
assert_equal(false, c.public_method_defined?(:bar))
assert_equal(false, c.public_method_defined?(:baz))
+ # Test if string arguments are converted to symbols
+ assert_equal(true, c.public_method_defined?("foo"))
+ assert_equal(false, c.public_method_defined?("bar"))
+ assert_equal(false, c.public_method_defined?("baz"))
+
assert_equal(false, c.protected_method_defined?(:foo))
assert_equal(true, c.protected_method_defined?(:bar))
assert_equal(false, c.protected_method_defined?(:baz))
+ # Test if string arguments are converted to symbols
+ assert_equal(false, c.protected_method_defined?("foo"))
+ assert_equal(true, c.protected_method_defined?("bar"))
+ assert_equal(false, c.protected_method_defined?("baz"))
+
assert_equal(false, c.private_method_defined?(:foo))
assert_equal(false, c.private_method_defined?(:bar))
assert_equal(true, c.private_method_defined?(:baz))
+
+ # Test if string arguments are converted to symbols
+ assert_equal(false, c.private_method_defined?("foo"))
+ assert_equal(false, c.private_method_defined?("bar"))
+ assert_equal(true, c.private_method_defined?("baz"))
end
def test_top_public_private