diff options
author | naruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-10-21 06:51:01 +0000 |
---|---|---|
committer | naruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-10-21 06:51:01 +0000 |
commit | 6187b0001b4df62ff38bb53b79f0501993570032 (patch) | |
tree | a70f09643462b6580960ff6949a1d642872b423b /test | |
parent | ae2578f6bc3f62bc4bc768be602067bd536fd3fe (diff) |
[Feature #13712] String#start_with? supports regexp
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60234 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r-- | test/ruby/test_string.rb | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/test/ruby/test_string.rb b/test/ruby/test_string.rb index 75da42eeef..b6c6214364 100644 --- a/test/ruby/test_string.rb +++ b/test/ruby/test_string.rb @@ -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 |