diff options
| author | Charles Oliver Nutter <headius@headius.com> | 2024-02-03 11:56:20 +0100 |
|---|---|---|
| committer | Hiroshi SHIBATA <hsbt@ruby-lang.org> | 2024-02-08 14:43:56 +0900 |
| commit | 39f2e37ff1c12cf4c9fec0b697a1495bc1930995 (patch) | |
| tree | d3868a7673bc5607d62d71b9a54a14c0259875a1 | |
| parent | 5afae77ce9bd7352e194d8603ebe35b3679207b3 (diff) | |
[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
| -rw-r--r-- | test/strscan/test_stringscanner.rb | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/test/strscan/test_stringscanner.rb b/test/strscan/test_stringscanner.rb index d15c1d8568..2a127a773a 100644 --- a/test/strscan/test_stringscanner.rb +++ b/test/strscan/test_stringscanner.rb @@ -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 |
