* test/fileutils/test_fileutils.rb: add test for FileUtils#uptodate?

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36401 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
ayumin 2012-07-16 08:15:08 +00:00
Родитель e6021a1be2
Коммит d570a76cba
2 изменённых файлов: 26 добавлений и 0 удалений

Просмотреть файл

@ -1,3 +1,7 @@
Mon Jul 16 17:05:53 2012 Ayumu AIZAWA <ayumu.aizawa@gmail.com>
* test/fileutils/test_fileutils.rb: add test for FileUtils#uptodate?
Mon Jul 16 16:56:12 2012 Ayumu AIZAWA <ayumu.aizawa@gmail.com>
* lib/fileutils.rb (public): remove useless parameter.

Просмотреть файл

@ -1117,8 +1117,30 @@ class TestFileUtils
uptodate? 'tmp/a', ['tmp/b', Pathname.new('tmp/c')]
uptodate? Pathname.new('tmp/a'), [Pathname.new('tmp/b'), Pathname.new('tmp/c')]
}
# [Bug #6708] [ruby-core:46256]
assert_raises_with_message(ArgumentError, "wrong number of arguments (3 for 2)") {
uptodate?('new',['old', 'oldest'], {})
}
end
def assert_raises_with_message(klass, message)
begin
yield
flunk("Expected Exception #{klass} didn't raise")
rescue klass => ex
if message.kind_of? String
flag = !!(ex.message == message)
assert(flag, "Expected Exception(#{klass}) was raised, but the message doesn't match")
elsif message.kind_of? Regexp
flag = !!(ex.message =~ message)
assert(flag, "Expected Exception(#{klass}) was raised, but the message doesn't match")
else
raise
end
end
end
private :assert_raises_with_message
def test_cd
check_singleton :cd
end