1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

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
This commit is contained in:
nobu 2015-10-26 13:43:19 +00:00
parent 4a6dff84f0
commit 0a74709e1a
2 changed files with 22 additions and 0 deletions

View file

@ -1,3 +1,10 @@
Mon Oct 26 22:43:03 2015 yui-knk <spiketeika@gmail.com>
* 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]
Mon Oct 26 22:23:30 2015 SimonDKnight <simondknight@hotmail.com>
* lib/racc/rdoc/grammar.en.rdoc: Grammatical errors fixed.

View file

@ -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