summaryrefslogtreecommitdiff
path: root/test/fiddle
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-07-28 13:06:43 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-07-28 13:06:43 +0000
commit440f4421ee068849fdf7e1698af903530bf51052 (patch)
treec82f4179f7f0baed28603d627235414357fabb32 /test/fiddle
parentd383426a4c6da604d816f44c7a783735e5ccb860 (diff)
downloadbundler-440f4421ee068849fdf7e1698af903530bf51052.tar.gz
test_function.rb: fix messages
* test/fiddle/test_function.rb (test_nogvl_poll): fix messages as failed conditions, with errno description. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64091 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/fiddle')
-rw-r--r--test/fiddle/test_function.rb17
1 files changed, 14 insertions, 3 deletions
diff --git a/test/fiddle/test_function.rb b/test/fiddle/test_function.rb
index cbf84eae9d..b799fb874a 100644
--- a/test/fiddle/test_function.rb
+++ b/test/fiddle/test_function.rb
@@ -86,9 +86,9 @@ module Fiddle
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
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)