mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* 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
This commit is contained in:
parent
2a067c6cec
commit
16c40ec1a5
2 changed files with 14 additions and 7 deletions
|
@ -1,3 +1,9 @@
|
|||
Tue May 4 18:38:16 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* 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@atdot.net>
|
||||
|
||||
* vm_insnhelper.c (argument_error): push correct backtrace.
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue