diff options
Diffstat (limited to 'test/stringio/test_stringio.rb')
-rw-r--r-- | test/stringio/test_stringio.rb | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/test/stringio/test_stringio.rb b/test/stringio/test_stringio.rb index 54f57165a4..a49326119f 100644 --- a/test/stringio/test_stringio.rb +++ b/test/stringio/test_stringio.rb @@ -525,6 +525,16 @@ class TestStringIO < Test::Unit::TestCase assert_equal([49, 50, 51, 52], f.each_codepoint.to_a) end + def test_each_codepoint_enumerator + io = StringIO.new('你好построить') + + chinese_part = io.each_codepoint.take(2).pack('U*') + russian_part = io.read(40).force_encoding('UTF-8') + + assert_equal("你好", chinese_part) + assert_equal("построить", russian_part) + end + def test_gets2 f = StringIO.new("foo\nbar\nbaz\n") assert_equal("fo", f.gets(2)) |