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