Project

General

Profile

Feature #5707 » tempfile-open2-tests.patch

akr (Akira Tanaka), 12/04/2011 11:31 PM

View differences:

test/ruby/test_io.rb (working copy)
return if /x86_64-linux/ !~ RUBY_PLATFORM # A binary form of struct flock depend on platform
pad=0
Tempfile.open(self.class.name) do |f|
Tempfile.open2(self.class.name) do |f|
r, w = IO.pipe
pid = fork do
r.close
......
start = 12
len = 34
sysid = 0
Tempfile.open(self.class.name) do |f|
Tempfile.open2(self.class.name) do |f|
r, w = IO.pipe
pid = fork do
r.close
......
end
def test_fcntl_dupfd
Tempfile.open(self.class.name) do |f|
Tempfile.open2(self.class.name) do |f|
fd = f.fcntl(Fcntl::F_DUPFD, 63)
begin
assert_operator(fd, :>=, 63)
test/rubygems/test_gem_format.rb (working copy)
end
def test_class_from_file_by_path_corrupt
Tempfile.open 'corrupt' do |io|
Tempfile.open2 'corrupt' do |io|
data = Gem.gzip 'a' * 10
io.write tar_file_header('metadata.gz', "\000x", 0644, data.length)
io.write data
test/rubygems/test_gem_package_tar_input.rb (working copy)
end
def test_initialize_no_metadata_file
Tempfile.open 'no_meta' do |io|
Tempfile.open2 'no_meta' do |io|
io.write tar_file_header('a', '', 0644, 1)
io.write 'a'
io.rewind
test/rdoc/test_rdoc_rdoc.rb (working copy)
skip "Encoding not implemented" unless Object.const_defined? :Encoding
@rdoc.options.encoding = Encoding::ISO_8859_1
Tempfile.open 'test.txt' do |io|
Tempfile.open2 'test.txt' do |io|
io.write 'hi'
io.rewind
......
end
def test_setup_output_dir_exists_file
Tempfile.open 'test_rdoc_rdoc' do |tempfile|
Tempfile.open2 'test_rdoc_rdoc' do |tempfile|
path = tempfile.path
e = assert_raises RDoc::Error do
test/psych/test_psych.rb (working copy)
def test_dump_file
hash = {'hello' => 'TGIF!'}
Tempfile.open('fun.yml') do |io|
Tempfile.open2('fun.yml') do |io|
assert_equal io, Psych.dump(hash, io)
io.rewind
assert_equal Psych.dump(hash), io.read
(2-2/2)