[ruby/strscan] Don't add begin to length for new string slice

(https://github.com/ruby/strscan/pull/87)

Fixes https://github.com/ruby/strscan/pull/86

https://github.com/ruby/strscan/commit/c17b015c00
This commit is contained in:
Charles Oliver Nutter 2024-02-03 11:56:20 +01:00 committed by Hiroshi SHIBATA
parent 5afae77ce9
commit 39f2e37ff1
No known key found for this signature in database
GPG Key ID: F9CF13417264FAC2

View File

@ -841,4 +841,12 @@ class TestStringScannerFixedAnchor < Test::Unit::TestCase
assert_equal 1, s.skip(/a/)
assert_nil s.skip(/^b/)
end
# ruby/strscan#86
def test_scan_shared_string
s = "hellohello"[5..-1]
ss = StringScanner.new(s).scan(/hello/)
assert_equal "hello", ss
end
end