From ab64f237714a72228096ae87aa6672583120595f Mon Sep 17 00:00:00 2001 From: nobu Date: Wed, 12 Jun 2013 03:44:48 +0000 Subject: io.c: fix 7bit coderange condition * io.c (io_getc): fix 7bit coderange condition, check if ascii read data instead of read length. [ruby-core:55444] [Bug #8516] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41250 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/ruby/test_io_m17n.rb | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'test/ruby/test_io_m17n.rb') diff --git a/test/ruby/test_io_m17n.rb b/test/ruby/test_io_m17n.rb index ac3b8eaa1e..dee36abaaf 100644 --- a/test/ruby/test_io_m17n.rb +++ b/test/ruby/test_io_m17n.rb @@ -2196,7 +2196,17 @@ EOT open("a", "wb") {|f| f.puts "a"} open("a", "rt") {|f| f.getc} } - assert(c.ascii_only?, "should be ascii_only #{bug4557}") + assert_predicate(c, :ascii_only?, bug4557) + end + + def test_getc_conversion + bug8516 = '[ruby-core:55444] [Bug #8516]' + c = with_tmpdir { + open("a", "wb") {|f| f.putc "\xe1"} + open("a", "r:iso-8859-1:utf-8") {|f| f.getc} + } + assert_not_predicate(c, :ascii_only?, bug8516) + assert_equal(1, c.size, bug8516) end def test_default_mode_on_dosish -- cgit v1.2.3