tempfile-open2-tests.patch

Akira Tanaka, 12/04/2011 11:31 PM

Download (3.16 KB)

View differences:

test/ruby/test_io.rb (working copy)
1854 1854
    return if /x86_64-linux/ !~ RUBY_PLATFORM # A binary form of struct flock depend on platform
1855 1855

  
1856 1856
    pad=0
1857
    Tempfile.open(self.class.name) do |f|
1857
    Tempfile.open2(self.class.name) do |f|
1858 1858
      r, w = IO.pipe
1859 1859
      pid = fork do
1860 1860
        r.close
......
1889 1889
    start = 12
1890 1890
    len = 34
1891 1891
    sysid = 0
1892
    Tempfile.open(self.class.name) do |f|
1892
    Tempfile.open2(self.class.name) do |f|
1893 1893
      r, w = IO.pipe
1894 1894
      pid = fork do
1895 1895
        r.close
......
1919 1919
  end
1920 1920

  
1921 1921
  def test_fcntl_dupfd
1922
    Tempfile.open(self.class.name) do |f|
1922
    Tempfile.open2(self.class.name) do |f|
1923 1923
      fd = f.fcntl(Fcntl::F_DUPFD, 63)
1924 1924
      begin
1925 1925
        assert_operator(fd, :>=, 63)
test/rubygems/test_gem_format.rb (working copy)
30 30
  end
31 31

  
32 32
  def test_class_from_file_by_path_corrupt
33
    Tempfile.open 'corrupt' do |io|
33
    Tempfile.open2 'corrupt' do |io|
34 34
      data = Gem.gzip 'a' * 10
35 35
      io.write tar_file_header('metadata.gz', "\000x", 0644, data.length)
36 36
      io.write data
test/rubygems/test_gem_package_tar_input.rb (working copy)
54 54
  end
55 55

  
56 56
  def test_initialize_no_metadata_file
57
    Tempfile.open 'no_meta' do |io|
57
    Tempfile.open2 'no_meta' do |io|
58 58
      io.write tar_file_header('a', '', 0644, 1)
59 59
      io.write 'a'
60 60
      io.rewind
test/rdoc/test_rdoc_rdoc.rb (working copy)
66 66
    skip "Encoding not implemented" unless Object.const_defined? :Encoding
67 67
    @rdoc.options.encoding = Encoding::ISO_8859_1
68 68

  
69
    Tempfile.open 'test.txt' do |io|
69
    Tempfile.open2 'test.txt' do |io|
70 70
      io.write 'hi'
71 71
      io.rewind
72 72

  
......
149 149
  end
150 150

  
151 151
  def test_setup_output_dir_exists_file
152
    Tempfile.open 'test_rdoc_rdoc' do |tempfile|
152
    Tempfile.open2 'test_rdoc_rdoc' do |tempfile|
153 153
      path = tempfile.path
154 154

  
155 155
      e = assert_raises RDoc::Error do
test/psych/test_psych.rb (working copy)
64 64

  
65 65
  def test_dump_file
66 66
    hash = {'hello' => 'TGIF!'}
67
    Tempfile.open('fun.yml') do |io|
67
    Tempfile.open2('fun.yml') do |io|
68 68
      assert_equal io, Psych.dump(hash, io)
69 69
      io.rewind
70 70
      assert_equal Psych.dump(hash), io.read