summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authornagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-11-29 08:21:32 +0000
committernagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-11-29 08:21:32 +0000
commit6d8ed07d66eb14fc3f35174420b385fb086a7ea0 (patch)
tree8a03349b7b168d23fa8fdb33daa02237a5e11c8e /test
parent43739c725cd576cf490f4275cc403aa64f9253d3 (diff)
merge revision(s) 51583,51638: [Backport #11444]
* io.c (rb_io_each_codepoint): read more data when read partially. [ruby-core:70379] [Bug #11444] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_2@52786 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r--test/ruby/test_io_m17n.rb20
1 files changed, 20 insertions, 0 deletions
diff --git a/test/ruby/test_io_m17n.rb b/test/ruby/test_io_m17n.rb
index 734b0172ac..17a427a12b 100644
--- a/test/ruby/test_io_m17n.rb
+++ b/test/ruby/test_io_m17n.rb
@@ -2563,4 +2563,24 @@ EOT
a.close rescue nil
b.close rescue nil
end
+
+ def test_each_codepoint_need_more
+ code = <<-'end;'
+ c = nil
+ begin
+ STDIN.set_encoding(Encoding::UTF_8).each_codepoint{|i| c = i}
+ rescue ArgumentError => e
+ STDERR.puts e.message
+ else
+ printf "%x", c
+ end
+ end;
+ args = ['-e', code]
+ bug11444 = '[ruby-core:70379] [Bug #11444]'
+ assert_in_out_err(args, "\u{1f376}".b[0,3], [],
+ ["invalid byte sequence in UTF-8"],
+ bug11444, timeout: 1)
+ assert_in_out_err(args, "x"*8190+"\u{1f376}", ["1f376"], [],
+ bug11444, timeout: 1)
+ end
end