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

ruby-changes:33977

From: nobu <ko1@a...>
Date: Fri, 23 May 2014 19:34:18 +0900 (JST)
Subject: [ruby-changes:33977] nobu:r46058 (trunk): test_file.rb: estimate birthtime

nobu	2014-05-23 19:34:13 +0900 (Fri, 23 May 2014)

  New Revision: 46058

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

  Log:
    test_file.rb: estimate birthtime
    
    * test/ruby/test_file.rb (test_stat): estimate expected birthtime
      by pinching.

  Modified files:
    trunk/test/ruby/test_file.rb
Index: test/ruby/test_file.rb
===================================================================
--- test/ruby/test_file.rb	(revision 46057)
+++ test/ruby/test_file.rb	(revision 46058)
@@ -312,7 +312,9 @@ class TestFile < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_file.rb#L312
   end
 
   def test_stat
+    tb = Process.clock_gettime(Process::CLOCK_REALTIME)
     file = Tempfile.new("stat")
+    tb = (tb + Process.clock_gettime(Process::CLOCK_REALTIME)) / 2
     file.close
     path = file.path
 
@@ -328,7 +330,7 @@ class TestFile < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_file.rb#L330
     delta = 1
     stat = File.stat(path)
     if stat.birthtime != stat.ctime
-      assert_in_delta t0,   stat.birthtime.to_f, delta
+      assert_in_delta tb,   stat.birthtime.to_f, delta
     end
     assert_in_delta t0+2, stat.mtime.to_f, delta
     assert_in_delta t0+4, stat.ctime.to_f, delta

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

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