diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-10-26 13:43:19 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-10-26 13:43:19 +0000 |
commit | 64d01ef60b3e9a21e086c948891ab47061b24428 (patch) | |
tree | 4bcaa46bf6cf4ba0fa4d4ac443e5b01f54be735d /test/ruby | |
parent | fd2b3c61e668e527b500a997ecc2ddb1d69cce69 (diff) | |
download | ruby-64d01ef60b3e9a21e086c948891ab47061b24428.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')
-rw-r--r-- | test/ruby/test_module.rb | 15 |
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 |