mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* test/fileutils/fileassertions.rb: new file.
* 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
This commit is contained in:
parent
ed970e2513
commit
577fa4c6a8
5 changed files with 463 additions and 0 deletions
43
test/fileutils/fileasserts.rb
Normal file
43
test/fileutils/fileasserts.rb
Normal file
|
@ -0,0 +1,43 @@
|
|||
#
|
||||
# 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
|
Loading…
Add table
Add a link
Reference in a new issue