summaryrefslogtreecommitdiff
path: root/test/fiddle/test_handle.rb
diff options
context:
space:
mode:
authorHiroshi SHIBATA <hsbt@ruby-lang.org>2021-09-05 04:54:25 +0900
committerNobuyoshi Nakada <nobu@ruby-lang.org>2021-09-05 17:43:48 +0900
commit8f752c95d20134bcc0b5394f1cea723a40f1ac8c (patch)
tree1bc3d801dee68a53a5b033e72261f2f374b0a5cc /test/fiddle/test_handle.rb
parentafa33da72b35fd8e98ebd56eb24b6204c35994ce (diff)
[ruby/fiddle] Use test-unit gem (https://github.com/ruby/fiddle/pull/69)
https://github.com/ruby/fiddle/commit/e08c4c635e Co-authored-by: Sutou Kouhei <kou@clear-code.com>
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/4810
Diffstat (limited to 'test/fiddle/test_handle.rb')
-rw-r--r--test/fiddle/test_handle.rb11
1 files changed, 10 insertions, 1 deletions
diff --git a/test/fiddle/test_handle.rb b/test/fiddle/test_handle.rb
index c0e85f7076..7e3ff9d844 100644
--- a/test/fiddle/test_handle.rb
+++ b/test/fiddle/test_handle.rb
@@ -185,7 +185,16 @@ module Fiddle
end if /freebsd/=~ RUBY_PLATFORM
def test_no_memory_leak
- assert_no_memory_leak(%w[-W0 -rfiddle.so], '', '100_000.times {Fiddle::Handle.allocate}; GC.start', rss: true)
+ if respond_to?(:assert_nothing_leaked_memory)
+ n_tries = 100_000
+ assert_nothing_leaked_memory(SIZEOF_VOIDP * (n_tries / 100)) do
+ n_tries.times do
+ Fiddle::Handle.allocate
+ end
+ end
+ else
+ assert_no_memory_leak(%w[-W0 -rfiddle.so], '', '100_000.times {Fiddle::Handle.allocate}; GC.start', rss: true)
+ end
end
if /cygwin|mingw|mswin/ =~ RUBY_PLATFORM