From 0a74709e1a9d545c7f637df7704618c596a9bc6e Mon Sep 17 00:00:00 2001 From: nobu Date: Mon, 26 Oct 2015 13:43:19 +0000 Subject: [PATCH] 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 --- ChangeLog | 7 +++++++ test/ruby/test_module.rb | 15 +++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/ChangeLog b/ChangeLog index 257fe7a321..95a87063d5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +Mon Oct 26 22:43:03 2015 yui-knk + + * 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 * lib/racc/rdoc/grammar.en.rdoc: Grammatical errors fixed. 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