[前][次][番号順一覧][スレッド一覧]

ruby-changes:40209

From: nobu <ko1@a...>
Date: Mon, 26 Oct 2015 22:43:49 +0900 (JST)
Subject: [ruby-changes:40209] nobu:r52290 (trunk): Add string argument test cases

nobu	2015-10-26 22:43:19 +0900 (Mon, 26 Oct 2015)

  New Revision: 52290

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=52290

  Log:
    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]

  Modified files:
    trunk/ChangeLog
    trunk/test/ruby/test_module.rb
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 52289)
+++ ChangeLog	(revision 52290)
@@ -1,3 +1,10 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Mon Oct 26 22:43:03 2015  yui-knk  <spiketeika@g...>
+
+	* 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@h...>
 
 	* lib/racc/rdoc/grammar.en.rdoc: Grammatical errors fixed.
Index: test/ruby/test_module.rb
===================================================================
--- test/ruby/test_module.rb	(revision 52289)
+++ test/ruby/test_module.rb	(revision 52290)
@@ -964,13 +964,28 @@ class TestModule < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_module.rb#L964
     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

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]