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

ruby-changes:14955

From: mame <ko1@a...>
Date: Sat, 6 Mar 2010 10:10:10 +0900 (JST)
Subject: [ruby-changes:14955] Ruby:r26826 (trunk): * io.c (rb_io_s_binwrite): use mode "r+b" instead of "ab" to handle

mame	2010-03-06 10:06:57 +0900 (Sat, 06 Mar 2010)

  New Revision: 26826

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

  Log:
    * io.c (rb_io_s_binwrite): use mode "r+b" instead of "ab" to handle
      offset correctly.  [ruby-core:28517]
    
    * test/ruby/test_io.rb: use assert_equal instead of assert.

  Modified files:
    trunk/ChangeLog
    trunk/io.c
    trunk/test/ruby/test_io.rb

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 26825)
+++ ChangeLog	(revision 26826)
@@ -1,3 +1,10 @@
+Sat Mar  6 10:03:35 2010  Yusuke Endoh  <mame@t...>
+
+	* io.c (rb_io_s_binwrite): use mode "r+b" instead of "ab" to handle
+	  offset correctly.  [ruby-core:28517]
+
+	* test/ruby/test_io.rb: use assert_equal instead of assert.
+
 Sat Mar  6 01:08:54 2010  NAKAMURA Usaku  <usa@r...>
 
 	* win32/Makefile.sub (config.h): VC6 has __int64.
Index: io.c
===================================================================
--- io.c	(revision 26825)
+++ io.c	(revision 26826)
@@ -8025,7 +8025,7 @@
     rb_scan_args(argc, argv, "21", NULL, &warg.str, &offset);
     if (!NIL_P(offset)) {
 	NUM2OFFT(offset);
-	mode = "ab:ASCII-8BIT";
+	mode = "r+b:ASCII-8BIT";
     }
     else {
 	mode = "wb:ASCII-8BIT";
Index: test/ruby/test_io.rb
===================================================================
--- test/ruby/test_io.rb	(revision 26825)
+++ test/ruby/test_io.rb	(revision 26826)
@@ -1518,13 +1518,13 @@
     path = t.path
     t.close(false)
     File.write(path, "foo\nbar\nbaz")
-    assert("foo\nbar\nbaz", File.read(path))
+    assert_equal("foo\nbar\nbaz", File.read(path))
     File.write(path, "FOO", 0)
-    assert("FOO\nbar\nbaz", File.read(path))
+    assert_equal("FOO\nbar\nbaz", File.read(path))
     File.write(path, "BAR")
-    assert("BAR", File.read(path))
+    assert_equal("BAR", File.read(path))
     File.write(path, "\u{3042}", mode: "w", encoding: "EUC-JP")
-    assert("\u{3042}".encode("EUC-JP"), File.read(path, encoding: "EUC-JP"))
+    assert_equal("\u{3042}".encode("EUC-JP"), File.read(path, encoding: "EUC-JP"))
     t.unlink
   end
 
@@ -1533,13 +1533,13 @@
     path = t.path
     t.close(false)
     File.binwrite(path, "foo\nbar\nbaz")
-    assert("foo\nbar\nbaz", File.read(path))
+    assert_equal("foo\nbar\nbaz", File.read(path))
     File.binwrite(path, "FOO", 0)
-    assert("FOO\nbar\nbaz", File.read(path))
+    assert_equal("FOO\nbar\nbaz", File.read(path))
     File.binwrite(path, "BAR")
-    assert("BAR", File.read(path))
+    assert_equal("BAR", File.read(path))
     File.binwrite(path, "\u{3042}")
-    assert("\u{3042}", File.read(path, encoding: "EUC-JP"))
+    assert_equal("\u{3042}", File.read(path))
     t.unlink
   end
 end

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

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