ruby-changes:43001
From: kazu <ko1@a...>
Date: Thu, 19 May 2016 21:24:03 +0900 (JST)
Subject: [ruby-changes:43001] kazu:r55075 (trunk): fix document of Regexp#match?
kazu 2016-05-19 21:23:57 +0900 (Thu, 19 May 2016) New Revision: 55075 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=55075 Log: fix document of Regexp#match? * re.c (rb_reg_match_m_p): [DOC] fix return value in rdoc. * test/ruby/test_regexp.rb (TestRegexp#test_match_p): add some tests from document. Modified files: trunk/ChangeLog trunk/re.c trunk/test/ruby/test_regexp.rb Index: ChangeLog =================================================================== --- ChangeLog (revision 55074) +++ ChangeLog (revision 55075) @@ -1,3 +1,10 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1 +Thu May 19 21:21:57 2016 Kazuhiro NISHIYAMA <zn@m...> + + * re.c (rb_reg_match_m_p): [DOC] fix return value in rdoc. + + * test/ruby/test_regexp.rb (TestRegexp#test_match_p): add some + tests from document. + Thu May 19 13:22:44 2016 Kazuki Yamaguchi <k@r...> * ext/openssl/ossl.c (Init_openssl): register an ex_data index for Index: test/ruby/test_regexp.rb =================================================================== --- test/ruby/test_regexp.rb (revision 55074) +++ test/ruby/test_regexp.rb (revision 55075) @@ -543,6 +543,9 @@ class TestRegexp < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_regexp.rb#L543 assert_equal(true, /../n.match?("\u3042" + '\x', 1)) assert_equal(true, /\z/.match?("")) assert_equal(true, /\z/.match?("abc")) + assert_equal(true, /R.../.match?("Ruby")) + assert_equal(false, /R.../.match?("Ruby", 1)) + assert_equal(false, /P.../.match?("Ruby")) assert_equal('backref', $&) end Index: re.c =================================================================== --- re.c (revision 55074) +++ re.c (revision 55075) @@ -3214,7 +3214,7 @@ rb_reg_match_m(int argc, VALUE *argv, VA https://github.com/ruby/ruby/blob/trunk/re.c#L3214 * to begin the search. * * /R.../.match?("Ruby") #=> true - * /R.../.match?("Ruby", 1) #=> true + * /R.../.match?("Ruby", 1) #=> false * /P.../.match?("Ruby") #=> false * $& #=> nil */ -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/