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

ruby-changes:22492

From: naruse <ko1@a...>
Date: Sat, 11 Feb 2012 03:20:08 +0900 (JST)
Subject: [ruby-changes:22492] naruse:r34541 (ruby_1_9_3): merge revision(s) 33152,33649:

naruse	2012-02-11 03:19:57 +0900 (Sat, 11 Feb 2012)

  New Revision: 34541

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

  Log:
    merge revision(s) 33152,33649:
    
    * test/ruby/test_io_m17n.rb (TestIO_M17N#test_{default_mode_on_dosish,
      default_mode_on_unix,text_mode,binary_mode}): sorry for wrong test
      committed in r33144.  I'd misunderstood the spec of ruby's universal
      newline.
    
    * test/ruby/test_io_m17n.rb
      (TestIO_M17N#test_default_stdout_stderr_mode): new test for
      r33627-33629.  see [backport #5565]

  Modified files:
    branches/ruby_1_9_3/ChangeLog
    branches/ruby_1_9_3/test/ruby/test_io_m17n.rb
    branches/ruby_1_9_3/version.h

Index: ruby_1_9_3/ChangeLog
===================================================================
--- ruby_1_9_3/ChangeLog	(revision 34540)
+++ ruby_1_9_3/ChangeLog	(revision 34541)
@@ -1,3 +1,16 @@
+Sat Feb 11 03:19:45 2012  NAKAMURA Usaku  <usa@r...>
+
+	* test/ruby/test_io_m17n.rb
+	  (TestIO_M17N#test_default_stdout_stderr_mode): new test for
+	  r33627-33629.  see [backport #5565]
+
+Sat Feb 11 03:19:45 2012  NAKAMURA Usaku  <usa@r...>
+
+	* test/ruby/test_io_m17n.rb (TestIO_M17N#test_{default_mode_on_dosish,
+	  default_mode_on_unix,text_mode,binary_mode}): sorry for wrong test
+	  committed in r33144.  I'd misunderstood the spec of ruby's universal
+	  newline.
+
 Sat Feb 11 03:17:41 2012  NAKAMURA Usaku  <usa@r...>
 
 	* test/ruby/test_io_m17n.rb (TestIO_M17N#test_{default_mode_on_dosish,
Index: ruby_1_9_3/version.h
===================================================================
--- ruby_1_9_3/version.h	(revision 34540)
+++ ruby_1_9_3/version.h	(revision 34541)
@@ -1,5 +1,5 @@
 #define RUBY_VERSION "1.9.3"
-#define RUBY_PATCHLEVEL 86
+#define RUBY_PATCHLEVEL 87
 
 #define RUBY_RELEASE_DATE "2012-02-11"
 #define RUBY_RELEASE_YEAR 2012
Index: ruby_1_9_3/test/ruby/test_io_m17n.rb
===================================================================
--- ruby_1_9_3/test/ruby/test_io_m17n.rb	(revision 34540)
+++ ruby_1_9_3/test/ruby/test_io_m17n.rb	(revision 34541)
@@ -2072,29 +2072,49 @@
 
   def test_default_mode_on_dosish
     with_tmpdir {
-      open("a", "w") {|f| f.puts}
+      open("a", "w") {|f| f.write "\n"}
       assert_equal("\r\n", IO.binread("a"))
     }
   end if /mswin|mingw/ =~ RUBY_PLATFORM
 
   def test_default_mode_on_unix
     with_tmpdir {
-      open("a", "w") {|f| f.puts}
+      open("a", "w") {|f| f.write "\n"}
       assert_equal("\n", IO.binread("a"))
     }
   end unless /mswin|mingw/ =~ RUBY_PLATFORM
 
   def test_text_mode
     with_tmpdir {
-      open("a", "wt") {|f| f.puts}
-      assert_equal("\r\n", IO.binread("a"))
+      open("a", "wb") {|f| f.write "\r\n"}
+      assert_equal("\n", open("a", "rt"){|f| f.read})
     }
   end
 
   def test_binary_mode
     with_tmpdir {
-      open("a", "wb") {|f| f.puts}
-      assert_equal("\n", IO.binread("a"))
+      open("a", "wb") {|f| f.write "\r\n"}
+      assert_equal("\r\n", open("a", "rb"){|f| f.read})
     }
   end
+
+  def test_default_stdout_stderr_mode
+    with_pipe do |in_r, in_w|
+      with_pipe do |out_r, out_w|
+        pid = Process.spawn({}, EnvUtil.rubybin, in: in_r, out: out_w, err: out_w)
+        in_r.close
+        out_w.close
+        in_w.write <<-EOS
+          STDOUT.puts "abc"
+          STDOUT.flush
+          STDERR.puts "def"
+          STDERR.flush
+        EOS
+        in_w.close
+        Process.wait pid
+        assert_equal "abc\r\ndef\r\n", out_r.binmode.read
+        out_r.close
+      end
+    end
+  end if /mswin|mingw/ =~ RUBY_PLATFORM
 end

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

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