aboutsummaryrefslogtreecommitdiffstats
path: root/test/ruby
diff options
context:
space:
mode:
authorYoann Lecuyer <yoann.lecuyer@gmail.com>2020-08-26 22:46:58 +0200
committerNobuyoshi Nakada <nobu@ruby-lang.org>2020-08-27 23:41:22 +0900
commitb3c1c767ea64ce435c115cece5074274b7aefadc (patch)
tree03b1c4cfa9f426df1bac008556f96952afe3ce8a /test/ruby
parent96d701f73780638ffd3c8fa91c43f33f1a207d65 (diff)
downloadruby-b3c1c767ea64ce435c115cece5074274b7aefadc.tar.gz
[stringio] fix stringio codepoint enumerator off by one error
Diffstat (limited to 'test/ruby')
-rw-r--r--test/ruby/test_io.rb13
1 files changed, 13 insertions, 0 deletions
diff --git a/test/ruby/test_io.rb b/test/ruby/test_io.rb
index 82f122489a..fafb082154 100644
--- a/test/ruby/test_io.rb
+++ b/test/ruby/test_io.rb
@@ -405,6 +405,19 @@ class TestIO < Test::Unit::TestCase
}
end
+ def test_each_codepoint_enumerator
+ make_tempfile {|t|
+ a = ""
+ b = ""
+ File.open(t, 'rt') {|f|
+ a = f.each_codepoint.take(4).pack('U*')
+ b = f.read(8)
+ }
+ assert_equal("foo\n", a)
+ assert_equal("bar\nbaz\n", b)
+ }
+ end
+
def test_codepoints
make_tempfile {|t|
bug2959 = '[ruby-core:28650]'