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

ruby-changes:51877

From: nobu <ko1@a...>
Date: Sat, 28 Jul 2018 22:06:49 +0900 (JST)
Subject: [ruby-changes:51877] nobu:r64091 (trunk): test_function.rb: fix messages

nobu	2018-07-28 22:06:43 +0900 (Sat, 28 Jul 2018)

  New Revision: 64091

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

  Log:
    test_function.rb: fix messages
    
    * test/fiddle/test_function.rb (test_nogvl_poll): fix messages as
      failed conditions, with errno description.

  Modified files:
    trunk/test/fiddle/test_function.rb
Index: test/fiddle/test_function.rb
===================================================================
--- test/fiddle/test_function.rb	(revision 64090)
+++ test/fiddle/test_function.rb	(revision 64091)
@@ -86,9 +86,9 @@ module Fiddle https://github.com/ruby/ruby/blob/trunk/test/fiddle/test_function.rb#L86
       n1 = f.call(nil, 0, msec)
       n2 = th.value
       t1 = Process.clock_gettime(Process::CLOCK_MONOTONIC, :millisecond)
-      assert_in_delta(msec, t1 - t0, 100, 'slept correct amount of time')
-      assert_equal(0, n1, 'poll(2) called correctly main-thread')
-      assert_equal(0, n2, 'poll(2) called correctly in sub-thread')
+      assert_in_delta(msec, t1 - t0, 100, 'slept amount of time')
+      assert_equal(0, n1, perror("poll(2) in main-thread"))
+      assert_equal(0, n2, perror("poll(2) in sub-thread"))
     end
 
     def test_no_memory_leak
@@ -96,5 +96,16 @@ module Fiddle https://github.com/ruby/ruby/blob/trunk/test/fiddle/test_function.rb#L96
       code = 'begin r.call(a); rescue TypeError; end'
       assert_no_memory_leak(%w[-W0 -rfiddle], "#{prep}\n1000.times{#{code}}", "10_000.times {#{code}}", limit: 1.2)
     end
+
+    private
+
+    def perror(m)
+      proc do
+        if e = Fiddle.last_error
+          m = "#{m}: #{SystemCallError.new(e).message}"
+        end
+        m
+      end
+    end
   end
 end if defined?(Fiddle)

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

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