[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:
naruse 2017-10-21 06:51:01 +00:00
parent ae2578f6bc
commit 6187b0001b
5 changed files with 98 additions and 5 deletions

View file

@ -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