* test/ruby/test_argf.rb: use temporally directory.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36445 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
ea3edd2744
commit
d5e9b69629
@ -1,3 +1,7 @@
|
|||||||
|
Wed Jul 18 21:59:46 2012 Tanaka Akira <akr@fsij.org>
|
||||||
|
|
||||||
|
* test/ruby/test_argf.rb: use temporally directory.
|
||||||
|
|
||||||
Wed Jul 18 19:41:19 2012 Tanaka Akira <akr@fsij.org>
|
Wed Jul 18 19:41:19 2012 Tanaka Akira <akr@fsij.org>
|
||||||
|
|
||||||
* test/openssl/test_config.rb: remove temporally files early.
|
* test/openssl/test_config.rb: remove temporally files early.
|
||||||
|
@ -2,43 +2,44 @@ require 'test/unit'
|
|||||||
require 'timeout'
|
require 'timeout'
|
||||||
require 'tmpdir'
|
require 'tmpdir'
|
||||||
require 'tempfile'
|
require 'tempfile'
|
||||||
|
require 'fileutils'
|
||||||
require_relative 'envutil'
|
require_relative 'envutil'
|
||||||
|
|
||||||
class TestArgf < Test::Unit::TestCase
|
class TestArgf < Test::Unit::TestCase
|
||||||
def setup
|
def setup
|
||||||
@t1 = Tempfile.new("argf-foo")
|
@tmpdir = Dir.mktmpdir
|
||||||
|
@tmp_count = 0
|
||||||
|
@t1 = make_tempfile0("argf-foo")
|
||||||
@t1.binmode
|
@t1.binmode
|
||||||
@t1.puts "1"
|
@t1.puts "1"
|
||||||
@t1.puts "2"
|
@t1.puts "2"
|
||||||
@t1.close
|
@t1.close
|
||||||
@t2 = Tempfile.new("argf-bar")
|
@t2 = make_tempfile0("argf-bar")
|
||||||
@t2.binmode
|
@t2.binmode
|
||||||
@t2.puts "3"
|
@t2.puts "3"
|
||||||
@t2.puts "4"
|
@t2.puts "4"
|
||||||
@t2.close
|
@t2.close
|
||||||
@t3 = Tempfile.new("argf-baz")
|
@t3 = make_tempfile0("argf-baz")
|
||||||
@t3.binmode
|
@t3.binmode
|
||||||
@t3.puts "5"
|
@t3.puts "5"
|
||||||
@t3.puts "6"
|
@t3.puts "6"
|
||||||
@t3.close
|
@t3.close
|
||||||
@tmps = [@t1, @t2, @t3]
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def teardown
|
def teardown
|
||||||
@tmps.each {|t|
|
FileUtils.rmtree(@tmpdir)
|
||||||
bak = t.path + ".bak"
|
end
|
||||||
File.unlink bak if File.file? bak
|
|
||||||
t.close(true)
|
def make_tempfile0(basename)
|
||||||
}
|
open("#{@tmpdir}/#{basename}-#{@tmp_count}", "w")
|
||||||
end
|
end
|
||||||
|
|
||||||
def make_tempfile
|
def make_tempfile
|
||||||
t = Tempfile.new("argf-qux")
|
t = make_tempfile0("argf-qux")
|
||||||
t.puts "foo"
|
t.puts "foo"
|
||||||
t.puts "bar"
|
t.puts "bar"
|
||||||
t.puts "baz"
|
t.puts "baz"
|
||||||
t.close
|
t.close
|
||||||
@tmps << t
|
|
||||||
t
|
t
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -417,11 +418,11 @@ class TestArgf < Test::Unit::TestCase
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
t1 = Tempfile.new("argf-foo")
|
t1 = open("#{@tmpdir}/argf-hoge", "w")
|
||||||
t1.binmode
|
t1.binmode
|
||||||
t1.puts "foo"
|
t1.puts "foo"
|
||||||
t1.close
|
t1.close
|
||||||
t2 = Tempfile.new("argf-bar")
|
t2 = open("#{@tmpdir}/argf-moge", "w")
|
||||||
t2.binmode
|
t2.binmode
|
||||||
t2.puts "bar"
|
t2.puts "bar"
|
||||||
t2.close
|
t2.close
|
||||||
|
Loading…
x
Reference in New Issue
Block a user