summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-02-20 08:20:10 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-02-20 08:20:10 +0000
commita520e71c5c29a275286eae4fb557a4e1d79c0d8e (patch)
treeb217ac7e2db8b7c1d94bcf73758c4312f1100b65 /test
parent5a76aceff659c9482167ee934d4fbf7c06df8b5c (diff)
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
Diffstat (limited to 'test')
-rw-r--r--test/ruby/test_file_exhaustive.rb17
1 files changed, 16 insertions, 1 deletions
diff --git a/test/ruby/test_file_exhaustive.rb b/test/ruby/test_file_exhaustive.rb
index 3e954e9d5d..84a6181e89 100644
--- a/test/ruby/test_file_exhaustive.rb
+++ b/test/ruby/test_file_exhaustive.rb
@@ -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))