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

ruby-changes:15694

From: nobu <ko1@a...>
Date: Tue, 4 May 2010 18:38:38 +0900 (JST)
Subject: [ruby-changes:15694] Ruby:r27614 (trunk): * test/fileutils/test_fileutils.rb (test_copy_stream):

nobu	2010-05-04 18:38:21 +0900 (Tue, 04 May 2010)

  New Revision: 27614

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

  Log:
    * test/fileutils/test_fileutils.rb (test_copy_stream):
      IO.copy_stream support binmode only currently.
      [ruby-core:23724]

  Modified files:
    trunk/ChangeLog
    trunk/test/fileutils/test_fileutils.rb

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 27613)
+++ ChangeLog	(revision 27614)
@@ -1,3 +1,9 @@
+Tue May  4 18:38:16 2010  Nobuyoshi Nakada  <nobu@r...>
+
+	* test/fileutils/test_fileutils.rb (test_copy_stream):
+	  IO.copy_stream support binmode only currently.
+	  [ruby-core:23724]
+
 Tue May  4 12:46:09 2010  Koichi Sasada  <ko1@a...>
 
 	* vm_insnhelper.c (argument_error): push correct backtrace.
Index: test/fileutils/test_fileutils.rb
===================================================================
--- test/fileutils/test_fileutils.rb	(revision 27613)
+++ test/fileutils/test_fileutils.rb	(revision 27614)
@@ -77,7 +77,7 @@
   include FileUtils
 
   def check_singleton(name)
-    assert_equal true, ::FileUtils.public_methods.include?(name.to_sym)
+    assert_respond_to ::FileUtils, name
   end
 
   def my_rm_rf(path)
@@ -941,20 +941,21 @@
     check_singleton :copy_stream
     # IO
     each_srcdest do |srcpath, destpath|
-      File.open(srcpath) {|src|
-        File.open(destpath, 'w') {|dest|
+      File.open(srcpath, 'rb') {|src|
+        File.open(destpath, 'wb') {|dest|
           copy_stream src, dest
         }
       }
       assert_same_file srcpath, destpath
     end
+  end
 
+  def test_copy_stream_duck
+    check_singleton :copy_stream
     # duck typing test  [ruby-dev:25369]
-    my_rm_rf 'tmp'
-    Dir.mkdir 'tmp'
     each_srcdest do |srcpath, destpath|
-      File.open(srcpath) {|src|
-        File.open(destpath, 'w') {|dest|
+      File.open(srcpath, 'rb') {|src|
+        File.open(destpath, 'wb') {|dest|
           copy_stream Stream.new(src), Stream.new(dest)
         }
       }

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

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