test_file_exhaustive.rb: tests for File.identical?
* test/ruby/test_file_exhaustive.rb (test_path_identical_p): rename and add other tests for File.identical? method. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49662 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
5a76aceff6
commit
a520e71c5c
@ -291,13 +291,28 @@ class TestFileExhaustive < Test::Unit::TestCase
|
||||
assert_file.not_sticky?(@file)
|
||||
end
|
||||
|
||||
def test_identical_p
|
||||
def test_path_identical_p
|
||||
assert_file.identical?(@file, @file)
|
||||
assert_file.not_identical?(@file, @zerofile)
|
||||
assert_file.not_identical?(@file, @nofile)
|
||||
assert_file.not_identical?(@nofile, @file)
|
||||
end
|
||||
|
||||
def test_io_identical_p
|
||||
open(@file) {|f|
|
||||
assert_file.identical?(f, f)
|
||||
assert_file.identical?(@file, f)
|
||||
assert_file.identical?(f, @file)
|
||||
}
|
||||
end
|
||||
|
||||
def test_closed_io_identical_p
|
||||
io = open(@file) {|f| f}
|
||||
assert_raise(IOError) {
|
||||
File.identical?(@file, io)
|
||||
}
|
||||
end
|
||||
|
||||
def test_s_size
|
||||
assert_integer(File.size(@dir))
|
||||
assert_equal(3, File.size(@file))
|
||||
|
Loading…
x
Reference in New Issue
Block a user