зеркало из https://github.com/github/ruby.git
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. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55075 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
2aabfcd4c6
Коммит
02942a6b90
|
@ -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
|
||||
|
|
2
re.c
2
re.c
|
@ -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
|
||||
*/
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче