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

ruby-changes:31074

From: nobu <ko1@a...>
Date: Sun, 6 Oct 2013 09:23:04 +0900 (JST)
Subject: [ruby-changes:31074] nobu:r43153 (trunk): test_sleep.rb: get rid of failure on Windows

nobu	2013-10-06 09:22:58 +0900 (Sun, 06 Oct 2013)

  New Revision: 43153

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

  Log:
    test_sleep.rb: get rid of failure on Windows
    
    * test/ruby/test_sleep.rb (test_sleep_5sec): relax bottom on Windows.
      assert_operator should test on the receiver.

  Modified files:
    trunk/test/ruby/test_sleep.rb
Index: test/ruby/test_sleep.rb
===================================================================
--- test/ruby/test_sleep.rb	(revision 43152)
+++ test/ruby/test_sleep.rb	(revision 43153)
@@ -6,8 +6,15 @@ class TestSleep < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_sleep.rb#L6
     start = Time.now
     sleep 5
     slept = Time.now-start
-    bottom = /linux/ =~ RUBY_PLATFORM && /Linux ([\d.]+)/ =~ `uname -sr` && ($1.split('.')<=>%w/2 6 18/)<1 ? 4.98 : 5.0
-    assert_operator(bottom, :<=, slept)
+    bottom =
+      case RUBY_PLATFORM
+      when /linux/
+        4.98 if /Linux ([\d.]+)/ =~ `uname -sr` && ($1.split('.')<=>%w/2 6 18/)<1
+      when /mswin|mingw/
+        4.98
+      end
+    bottom ||= 5.0
+    assert_operator(slept, :>=, bottom)
     assert_operator(slept, :<=, 6.0, "[ruby-core:18015]: longer than expected")
   ensure
     GC.enable

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

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