diff options
author | Nobuyoshi Nakada <[email protected]> | 2023-06-28 12:39:52 +0900 |
---|---|---|
committer | Nobuyoshi Nakada <[email protected]> | 2023-06-28 14:06:28 +0900 |
commit | 0cbfeb8210cd177bee95c512834c483daec36f74 (patch) | |
tree | f49c29d8b1038ddd7d3249300683c619bba15a3c /test | |
parent | 9e709d0f4a55c6d3e0b66569b287b6bc3451cf23 (diff) |
[Bug #19746] `String#index` with regexp should clear `$~` unless matched
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/7988
Diffstat (limited to 'test')
-rw-r--r-- | test/ruby/test_string.rb | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/test/ruby/test_string.rb b/test/ruby/test_string.rb index 08b6664cca..215fccfb64 100644 --- a/test/ruby/test_string.rb +++ b/test/ruby/test_string.rb @@ -1375,6 +1375,7 @@ CODE assert_raise(TypeError) { S("foo").index(Object.new) } assert_index(nil, S("foo"), //, -100) + assert_index(nil, S("foo"), //, 4) assert_index(2, S("abcdbce"), /b\Kc/) @@ -1562,6 +1563,7 @@ CODE m = assert_rindex(3, S("foo"), //) assert_equal([3, 3], m.offset(0)) + assert_rindex(3, S("foo"), //, 4) assert_rindex(5, S("abcdbce"), /b\Kc/) @@ -3380,6 +3382,7 @@ CODE assert_raise(TypeError) { S("foo").byteindex(Object.new) } assert_byteindex(nil, S("foo"), //, -100) + assert_byteindex(nil, S("foo"), //, -4) assert_byteindex(2, S("abcdbce"), /b\Kc/) @@ -3427,6 +3430,7 @@ CODE m = assert_byterindex(3, S("foo"), //) assert_equal([3, 3], m.offset(0)) + assert_byterindex(3, S("foo"), //, 4) assert_byterindex(5, S("abcdbce"), /b\Kc/) |