mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
577fa4c6a8
* test/fileutils/test_fileutils.rb: new file. * test/fileutils/test_nowrite.rb: new file. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4564 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
43 lines
857 B
Ruby
43 lines
857 B
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( file )
|
|
_wrap_assertion {
|
|
assert_block("file not exist: #{file}") {
|
|
File.exist?(file)
|
|
}
|
|
}
|
|
end
|
|
|
|
def assert_file_not_exist( file )
|
|
_wrap_assertion {
|
|
assert_block("file not exist: #{file}") {
|
|
not File.exist?(file)
|
|
}
|
|
}
|
|
end
|
|
|
|
def assert_is_directory( file )
|
|
_wrap_assertion {
|
|
assert_block("is not directory: #{file}") {
|
|
File.directory?(file)
|
|
}
|
|
}
|
|
end
|
|
|
|
end
|
|
end
|
|
end
|