summaryrefslogtreecommitdiff
path: root/test/fileutils
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-05-04 09:38:21 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-05-04 09:38:21 +0000
commit16c40ec1a5258250876b3b95a299397a79244a10 (patch)
treed784508b439ef02510005bdb0ffce9a55610a4f2 /test/fileutils
parent2a067c6cec648981fd4e9b5f466bc2a11f29c79c (diff)
* test/fileutils/test_fileutils.rb (test_copy_stream):
IO.copy_stream support binmode only currently. [ruby-core:23724] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27614 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/fileutils')
-rw-r--r--test/fileutils/test_fileutils.rb15
1 files changed, 8 insertions, 7 deletions
diff --git a/test/fileutils/test_fileutils.rb b/test/fileutils/test_fileutils.rb
index 7bedef6..f385589 100644
--- a/test/fileutils/test_fileutils.rb
+++ b/test/fileutils/test_fileutils.rb
@@ -77,7 +77,7 @@ class TestFileUtils
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 @@ class TestFileUtils
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)
}
}