From 0f99627a7981f31fd6bed4e6daf12c862103dc08 Mon Sep 17 00:00:00 2001 From: headius Date: Mon, 15 Dec 2014 18:56:30 +0000 Subject: * test/ruby/test_io_m17n.rb: Add test for coderange clearing in IO#read with buffer. See jruby/jruby#2316. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48847 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/ruby/test_io_m17n.rb | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/test/ruby/test_io_m17n.rb b/test/ruby/test_io_m17n.rb index 97512f0d61..734b0172ac 100644 --- a/test/ruby/test_io_m17n.rb +++ b/test/ruby/test_io_m17n.rb @@ -2547,4 +2547,20 @@ EOT end } end if /mswin|mingw/ =~ RUBY_PLATFORM + + def test_read_with_buf_broken_ascii_only + a, b = IO.pipe + a.binmode + b.binmode + b.write("\xE2\x9C\x93") + b.close + + buf = "".force_encoding("binary") + assert buf.ascii_only?, "should have been ascii_only?" + a.read(1, buf) + assert !buf.ascii_only?, "should not have been ascii_only?" + ensure + a.close rescue nil + b.close rescue nil + end end -- cgit v1.2.3