From 6187b0001b4df62ff38bb53b79f0501993570032 Mon Sep 17 00:00:00 2001 From: naruse Date: Sat, 21 Oct 2017 06:51:01 +0000 Subject: [Feature #13712] String#start_with? supports regexp git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60234 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/ruby/test_string.rb | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'test/ruby') 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 -- cgit v1.2.3