1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* test/ruby/envutil.rb (Test::Unit::Assertions#assert_file): rename from file_assertion.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37215 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
kazu 2012-10-16 04:02:04 +00:00
parent 41e5fdb20f
commit 66141d47d7
8 changed files with 27 additions and 22 deletions

View file

@ -1,3 +1,8 @@
Tue Oct 16 12:52:14 2012 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
* test/ruby/envutil.rb (Test::Unit::Assertions#assert_file):
rename from file_assertion.
Tue Oct 16 11:30:18 2012 Nobuyoshi Nakada <nobu@ruby-lang.org> Tue Oct 16 11:30:18 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
* file.c (rb_file_join): hide the result under construction until * file.c (rb_file_join): hide the result under construction until

View file

@ -225,11 +225,11 @@ module Test
assert(1.0/f == -Float::INFINITY, "#{f} is not -0.0") assert(1.0/f == -Float::INFINITY, "#{f} is not -0.0")
end end
def file_assertion def assert_file
FileAssertion AssertFile
end end
class << (FileAssertion = Object.new) class << (AssertFile = Object.new)
include Assertions include Assertions
def assert_file_predicate(predicate, *args) def assert_file_predicate(predicate, *args)
if /\Anot_/ =~ predicate if /\Anot_/ =~ predicate

View file

@ -44,7 +44,7 @@ class TestFile < Test::Unit::TestCase
bug6487 = '[ruby-core:45203]' bug6487 = '[ruby-core:45203]'
f = Tempfile.new(__method__.to_s) f = Tempfile.new(__method__.to_s)
f.close f.close
file_assertion.exist?(f.path) assert_file.exist?(f.path)
assert_nothing_raised(bug6487) {File.read(f.path, mode: 'r:utf-8')} assert_nothing_raised(bug6487) {File.read(f.path, mode: 'r:utf-8')}
assert_nothing_raised(bug6487) {File.read(f.path, mode: 'r:bom|utf-8')} assert_nothing_raised(bug6487) {File.read(f.path, mode: 'r:bom|utf-8')}
f.close(true) f.close(true)
@ -356,7 +356,7 @@ class TestFile < Test::Unit::TestCase
assert_raise(ArgumentError) do assert_raise(ArgumentError) do
open(path + "\0bar", "w") {} open(path + "\0bar", "w") {}
end end
file_assertion.not_exist?(path) assert_file.not_exist?(path)
end end
end end
end end

View file

@ -120,7 +120,7 @@ class TestFileExhaustive < Test::Unit::TestCase
Dir.mktmpdir do |dir| Dir.mktmpdir do |dir|
prefix = File.join(dir, "...a") prefix = File.join(dir, "...a")
Dir.mkdir(prefix) Dir.mkdir(prefix)
file_assertion.exist?(prefix) assert_file.exist?(prefix)
assert_nothing_raised { File.stat(prefix) } assert_nothing_raised { File.stat(prefix) }
@ -170,9 +170,9 @@ class TestFileExhaustive < Test::Unit::TestCase
end end
def test_exist_p def test_exist_p
file_assertion.exist?(@dir) assert_file.exist?(@dir)
file_assertion.exist?(@file) assert_file.exist?(@file)
file_assertion.not_exist?(@nofile) assert_file.not_exist?(@nofile)
end end
def test_readable_p def test_readable_p
@ -399,8 +399,8 @@ class TestFileExhaustive < Test::Unit::TestCase
def test_rename def test_rename
assert_equal(0, File.rename(@file, @nofile)) assert_equal(0, File.rename(@file, @nofile))
file_assertion.not_exist?(@file) assert_file.not_exist?(@file)
file_assertion.exist?(@nofile) assert_file.exist?(@nofile)
assert_equal(0, File.rename(@nofile, @file)) assert_equal(0, File.rename(@nofile, @file))
assert_raise(Errno::ENOENT) { File.rename(@nofile, @file) } assert_raise(Errno::ENOENT) { File.rename(@nofile, @file) }
end end
@ -809,21 +809,21 @@ class TestFileExhaustive < Test::Unit::TestCase
def test_truncate def test_truncate
assert_equal(0, File.truncate(@file, 1)) assert_equal(0, File.truncate(@file, 1))
file_assertion.exist?(@file) assert_file.exist?(@file)
assert_equal(1, File.size(@file)) assert_equal(1, File.size(@file))
assert_equal(0, File.truncate(@file, 0)) assert_equal(0, File.truncate(@file, 0))
file_assertion.exist?(@file) assert_file.exist?(@file)
file_assertion.zero?(@file) assert_file.zero?(@file)
make_file("foo", @file) make_file("foo", @file)
assert_raise(Errno::ENOENT) { File.truncate(@nofile, 0) } assert_raise(Errno::ENOENT) { File.truncate(@nofile, 0) }
f = File.new(@file, "w") f = File.new(@file, "w")
assert_equal(0, f.truncate(2)) assert_equal(0, f.truncate(2))
file_assertion.exist?(@file) assert_file.exist?(@file)
assert_equal(2, File.size(@file)) assert_equal(2, File.size(@file))
assert_equal(0, f.truncate(0)) assert_equal(0, f.truncate(0))
file_assertion.exist?(@file) assert_file.exist?(@file)
file_assertion.zero?(@file) assert_file.zero?(@file)
f.close f.close
make_file("foo", @file) make_file("foo", @file)

View file

@ -403,8 +403,8 @@ class TestProcess < Test::Unit::TestCase
with_tmpchdir {|d| with_tmpchdir {|d|
Dir.mkdir "foo" Dir.mkdir "foo"
system(*PWD, :chdir => "foo", :out => "open_chdir_test") system(*PWD, :chdir => "foo", :out => "open_chdir_test")
file_assertion.exist?("open_chdir_test") assert_file.exist?("open_chdir_test")
file_assertion.not_exist?("foo/open_chdir_test") assert_file.not_exist?("foo/open_chdir_test")
assert_equal("#{d}/foo", File.read("open_chdir_test").chomp) assert_equal("#{d}/foo", File.read("open_chdir_test").chomp)
} }
end end

View file

@ -109,7 +109,7 @@ class TestRequire < Test::Unit::TestCase
Dir.mktmpdir do |tmp| Dir.mktmpdir do |tmp|
req = File.join(tmp, "very_long_file_name.rb") req = File.join(tmp, "very_long_file_name.rb")
File.write(req, "p :ok\n") File.write(req, "p :ok\n")
file_assertion.exist?(req) assert_file.exist?(req)
req[/.rb$/i] = "" req[/.rb$/i] = ""
assert_in_out_err(['--disable-gems'], <<-INPUT, %w(:ok), []) assert_in_out_err(['--disable-gems'], <<-INPUT, %w(:ok), [])
require "#{req}" require "#{req}"

View file

@ -388,7 +388,7 @@ class TestRubyOptions < Test::Unit::TestCase
rubybin = Regexp.quote(EnvUtil.rubybin) rubybin = Regexp.quote(EnvUtil.rubybin)
pat = Regexp.quote(notexist) pat = Regexp.quote(notexist)
bug1573 = '[ruby-core:23717]' bug1573 = '[ruby-core:23717]'
file_assertion.not_exist?(notexist) assert_file.not_exist?(notexist)
assert_in_out_err(["-r", notexist, "-ep"], "", [], /.* -- #{pat} \(LoadError\)/, bug1573) assert_in_out_err(["-r", notexist, "-ep"], "", [], /.* -- #{pat} \(LoadError\)/, bug1573)
assert_in_out_err([notexist], "", [], /#{rubybin}:.* -- #{pat} \(LoadError\)/, bug1573) assert_in_out_err([notexist], "", [], /#{rubybin}:.* -- #{pat} \(LoadError\)/, bug1573)
end end

View file

@ -69,7 +69,7 @@ class TestWhileuntil < Test::Unit::TestCase
tmp.close tmp.close
File.unlink tmpfilename or `/bin/rm -f "#{tmpfilename}"` File.unlink tmpfilename or `/bin/rm -f "#{tmpfilename}"`
file_assertion.not_exist?(tmpfilename) assert_file.not_exist?(tmpfilename)
} }
end end