[ruby/strscan] Add test case to test_string

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

`string` returns the original string after `scan` is called. Current
test doesn't check this behavior and now it's covered.
This commit is contained in:
OKURA Masafumi 2023-02-09 05:46:25 +09:00 committed by Hiroshi SHIBATA
parent 18e840ac60
commit 260bc7cdfa

View File

@ -155,8 +155,10 @@ class TestStringScanner < Test::Unit::TestCase
end
def test_string
s = create_string_scanner('test')
assert_equal 'test', s.string
s = create_string_scanner('test string')
assert_equal 'test string', s.string
s.scan(/test/)
assert_equal 'test string', s.string
s.string = 'a'
assert_equal 'a', s.string
s.scan(/a/)