aboutsummaryrefslogtreecommitdiffstats
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
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
-rw-r--r--ChangeLog7
-rw-r--r--test/ruby/test_module.rb15
2 files changed, 22 insertions, 0 deletions
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 <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.
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