[前][次][番号順一覧][スレッド一覧]

ruby-changes:36766

From: headius <ko1@a...>
Date: Tue, 16 Dec 2014 03:56:43 +0900 (JST)
Subject: [ruby-changes:36766] headius:r48847 (trunk): * test/ruby/test_io_m17n.rb: Add test for coderange clearing in

headius	2014-12-16 03:56:30 +0900 (Tue, 16 Dec 2014)

  New Revision: 48847

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=48847

  Log:
    * test/ruby/test_io_m17n.rb: Add test for coderange clearing in
      IO#read with buffer. See jruby/jruby#2316.

  Modified files:
    trunk/test/ruby/test_io_m17n.rb
Index: test/ruby/test_io_m17n.rb
===================================================================
--- test/ruby/test_io_m17n.rb	(revision 48846)
+++ test/ruby/test_io_m17n.rb	(revision 48847)
@@ -2547,4 +2547,20 @@ EOT https://github.com/ruby/ruby/blob/trunk/test/ruby/test_io_m17n.rb#L2547
       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

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]