mirror of
https://github.com/ruby/ruby.git
synced 2025-08-28 15:36:16 +02:00
[Feature #13712] String#start_with? supports regexp
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60234 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
ae2578f6bc
commit
6187b0001b
5 changed files with 98 additions and 5 deletions
|
@ -1723,6 +1723,11 @@ CODE
|
|||
|
||||
bug5536 = '[ruby-core:40623]'
|
||||
assert_raise(TypeError, bug5536) {S("str").start_with? :not_convertible_to_string}
|
||||
|
||||
assert_equal(true, "hello".start_with?(/hel/))
|
||||
assert_equal("hel", $&)
|
||||
assert_equal(false, "hello".start_with?(/el/))
|
||||
assert_nil($&)
|
||||
end
|
||||
|
||||
def test_strip
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue