diff options
Diffstat (limited to 'test/strscan/test_stringscanner.rb')
-rw-r--r-- | test/strscan/test_stringscanner.rb | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/test/strscan/test_stringscanner.rb b/test/strscan/test_stringscanner.rb index f8b5836919..2c4cf90828 100644 --- a/test/strscan/test_stringscanner.rb +++ b/test/strscan/test_stringscanner.rb @@ -1,3 +1,4 @@ +# -*- coding: utf-8 -*- # # test/strscan/test_stringscanner.rb # @@ -199,6 +200,17 @@ class TestStringScanner < Test::Unit::TestCase assert_equal 11, s.pos end + def test_pos_unicode + s = StringScanner.new("abcädeföghi") + assert_equal 0, s.charpos + assert_equal "abcä", s.scan_until(/ä/) + assert_equal 4, s.charpos + assert_equal "defö", s.scan_until(/ö/) + assert_equal 8, s.charpos + s.terminate + assert_equal 11, s.charpos + end + def test_concat s = StringScanner.new('a') s.scan(/a/) |