mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
2bfd5c1a3d
* lib/fileutils.rb: use Object#is_a? instead of Class#=== to allow e.g. remote objects for receivers. * lib/fileutils.rb: FileTest -> File. * lib/fileutils.rb: put parentheses for arguments of File.xxxx? * test/fileutils/test_fileutils.rb (test_cp): test "cp a a". * test/fileutils/test_fileutils.rb (test_mv): test "mv a a". * test/fileutils/test_fileutils.rb (test_ln): test "ln a a". * test/fileutils/test_fileutils.rb (test_ln_s): test "ln_s a a". * test/fileutils/test_fileutils.rb (test_install): test "install a a". * test/fileutils/fileasserts.rb: new method assert_symlink. * test/fileutils/fileasserts.rb: assert_is_directory -> assert_directory. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4976 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
51 lines
1 KiB
Ruby
51 lines
1 KiB
Ruby
#
|
|
# test/fileutils/fileasserts.rb
|
|
#
|
|
|
|
module Test
|
|
module Unit
|
|
module Assertions # redefine
|
|
|
|
def assert_same_file( from, to )
|
|
_wrap_assertion {
|
|
assert_block("file #{from} != #{to}") {
|
|
File.read(from) == File.read(to)
|
|
}
|
|
}
|
|
end
|
|
|
|
def assert_file_exist( path )
|
|
_wrap_assertion {
|
|
assert_block("file not exist: #{path}") {
|
|
File.exist?(path)
|
|
}
|
|
}
|
|
end
|
|
|
|
def assert_file_not_exist( path )
|
|
_wrap_assertion {
|
|
assert_block("file not exist: #{path}") {
|
|
not File.exist?(path)
|
|
}
|
|
}
|
|
end
|
|
|
|
def assert_directory( path )
|
|
_wrap_assertion {
|
|
assert_block("is not directory: #{path}") {
|
|
File.directory?(path)
|
|
}
|
|
}
|
|
end
|
|
|
|
def assert_symlink( path )
|
|
_wrap_assertion {
|
|
assert_block("is no symlink: #{path}") {
|
|
File.symlink?(path)
|
|
}
|
|
}
|
|
end
|
|
|
|
end
|
|
end
|
|
end
|