diff options
-rw-r--r-- | ChangeLog | 7 | ||||
-rw-r--r-- | re.c | 2 | ||||
-rw-r--r-- | test/ruby/test_regexp.rb | 3 |
3 files changed, 11 insertions, 1 deletions
@@ -1,3 +1,10 @@ +Thu May 19 21:21:57 2016 Kazuhiro NISHIYAMA <zn@mbf.nifty.com> + + * 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@rhe.jp> * ext/openssl/ossl.c (Init_openssl): register an ex_data index for @@ -3214,7 +3214,7 @@ rb_reg_match_m(int argc, VALUE *argv, VALUE re) * to begin the search. * * /R.../.match?("Ruby") #=> true - * /R.../.match?("Ruby", 1) #=> true + * /R.../.match?("Ruby", 1) #=> false * /P.../.match?("Ruby") #=> false * $& #=> nil */ diff --git a/test/ruby/test_regexp.rb b/test/ruby/test_regexp.rb index c25433b1ff..34466e0262 100644 --- a/test/ruby/test_regexp.rb +++ b/test/ruby/test_regexp.rb @@ -543,6 +543,9 @@ class TestRegexp < Test::Unit::TestCase 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 |