mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* test/ruby/test_argf.rb (test_inplace_rename_impossible): unlink
the renamed temporary file on no_safe_rename platforms. * test/ruby/test_argf.rb (test_readlines_limit_0, test_each_line_limit_0): should close argf because the associated Tempfile object cannot unlink the temporary file when it's gc'ed on some platforms (Windows, etc.) git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30199 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
00aab58537
commit
fae9930033
2 changed files with 24 additions and 4 deletions
10
ChangeLog
10
ChangeLog
|
@ -1,3 +1,13 @@
|
||||||
|
Tue Dec 14 11:30:17 2010 NAKAMURA Usaku <usa@ruby-lang.org>
|
||||||
|
|
||||||
|
* test/ruby/test_argf.rb (test_inplace_rename_impossible): unlink
|
||||||
|
the renamed temporary file on no_safe_rename platforms.
|
||||||
|
|
||||||
|
* test/ruby/test_argf.rb (test_readlines_limit_0,
|
||||||
|
test_each_line_limit_0): should close argf because the associated
|
||||||
|
Tempfile object cannot unlink the temporary file when it's gc'ed
|
||||||
|
on some platforms (Windows, etc.)
|
||||||
|
|
||||||
Tue Dec 14 11:27:07 2010 NARUSE, Yui <naruse@ruby-lang.org>
|
Tue Dec 14 11:27:07 2010 NARUSE, Yui <naruse@ruby-lang.org>
|
||||||
|
|
||||||
* lib/minitest/unit.rb (Minitest::Unit#_run_suite): split test
|
* lib/minitest/unit.rb (Minitest::Unit#_run_suite): split test
|
||||||
|
|
|
@ -210,6 +210,7 @@ class TestArgf < Test::Unit::TestCase
|
||||||
assert_equal([], e)
|
assert_equal([], e)
|
||||||
assert_equal([], r)
|
assert_equal([], r)
|
||||||
assert_equal("foo.new\nbar.new\nbaz.new\n", File.read(t.path))
|
assert_equal("foo.new\nbar.new\nbaz.new\n", File.read(t.path))
|
||||||
|
File.unlink(t.path + ".~~~") rescue nil
|
||||||
else
|
else
|
||||||
assert_match(/Can't rename .* to .*: .*. skipping file/, e.first) #'
|
assert_match(/Can't rename .* to .*: .*. skipping file/, e.first) #'
|
||||||
assert_equal([], r)
|
assert_equal([], r)
|
||||||
|
@ -699,17 +700,26 @@ class TestArgf < Test::Unit::TestCase
|
||||||
bug4024 = '[ruby-dev:42538]'
|
bug4024 = '[ruby-dev:42538]'
|
||||||
t = make_tempfile
|
t = make_tempfile
|
||||||
argf = ARGF.class.new(t.path)
|
argf = ARGF.class.new(t.path)
|
||||||
|
begin
|
||||||
assert_raise(ArgumentError, bug4024) do
|
assert_raise(ArgumentError, bug4024) do
|
||||||
argf.readlines(0)
|
argf.readlines(0)
|
||||||
end
|
end
|
||||||
|
ensure
|
||||||
|
argf.close
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_each_line_limit_0
|
def test_each_line_limit_0
|
||||||
bug4024 = '[ruby-dev:42538]'
|
bug4024 = '[ruby-dev:42538]'
|
||||||
t = make_tempfile
|
t = make_tempfile
|
||||||
argf = ARGF.class.new(t.path)
|
argf = ARGF.class.new(t.path)
|
||||||
|
begin
|
||||||
assert_raise(ArgumentError, bug4024) do
|
assert_raise(ArgumentError, bug4024) do
|
||||||
argf.each_line(0).next
|
argf.each_line(0).next
|
||||||
end
|
end
|
||||||
|
ensure
|
||||||
|
argf.close
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue