[前][次][番号順一覧][スレッド一覧]

ruby-changes:37581

From: nobu <ko1@a...>
Date: Fri, 20 Feb 2015 17:20:18 +0900 (JST)
Subject: [ruby-changes:37581] nobu:r49662 (trunk): test_file_exhaustive.rb: tests for File.identical?

nobu	2015-02-20 17:20:10 +0900 (Fri, 20 Feb 2015)

  New Revision: 49662

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=49662

  Log:
    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.

  Modified files:
    trunk/test/ruby/test_file_exhaustive.rb
Index: test/ruby/test_file_exhaustive.rb
===================================================================
--- test/ruby/test_file_exhaustive.rb	(revision 49661)
+++ test/ruby/test_file_exhaustive.rb	(revision 49662)
@@ -291,13 +291,28 @@ class TestFileExhaustive < Test::Unit::T https://github.com/ruby/ruby/blob/trunk/test/ruby/test_file_exhaustive.rb#L291
     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))

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]