summaryrefslogtreecommitdiff
path: root/test/ruby/test_io_m17n.rb
diff options
context:
space:
mode:
authorheadius <headius@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-12-15 18:56:30 +0000
committerheadius <headius@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-12-15 18:56:30 +0000
commit0f99627a7981f31fd6bed4e6daf12c862103dc08 (patch)
tree47718c5ef7993aa4078c7adf4856b257d998ab0a /test/ruby/test_io_m17n.rb
parent85b42fe17b67688143e26f72b47aad766744ac3a (diff)
* 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
Diffstat (limited to 'test/ruby/test_io_m17n.rb')
-rw-r--r--test/ruby/test_io_m17n.rb16
1 files changed, 16 insertions, 0 deletions
diff --git a/test/ruby/test_io_m17n.rb b/test/ruby/test_io_m17n.rb
index 97512f0d61d..734b0172ac0 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