aboutsummaryrefslogtreecommitdiffstats
path: root/test/fiddle/test_handle.rb
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-03-09 04:19:10 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-03-09 04:19:10 +0000
commitcb05f199ee303448129a84d07a2ca698890f4c1f (patch)
treedf3b79f04b4d5e1fab5718456faa990c62347cd3 /test/fiddle/test_handle.rb
parente20cd8ee490537127fa07e22991bdc22402953e4 (diff)
downloadruby-cb05f199ee303448129a84d07a2ca698890f4c1f.tar.gz
tests for [Bug #9599]
* test/dl/test_{cptr,handle}.rb: tests for [Bug #9599]. * test/fiddle/test_{handle,pointer}.rb: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45299 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/fiddle/test_handle.rb')
-rw-r--r--test/fiddle/test_handle.rb7
1 files changed, 7 insertions, 0 deletions
diff --git a/test/fiddle/test_handle.rb b/test/fiddle/test_handle.rb
index c598cc33a2..aa18c03978 100644
--- a/test/fiddle/test_handle.rb
+++ b/test/fiddle/test_handle.rb
@@ -1,5 +1,6 @@
begin
require_relative 'helper'
+ require_relative '../ruby/envutil'
rescue LoadError
end
@@ -7,6 +8,8 @@ module Fiddle
class TestHandle < TestCase
include Fiddle
+ include Test::Unit::Assertions
+
def test_to_i
handle = Fiddle::Handle.new(LIBC_SO)
assert_kind_of Integer, handle.to_i
@@ -185,5 +188,9 @@ module Fiddle
Socket.gethostbyname("localhost")
Fiddle.dlopen("/lib/libc.so.7").sym('strcpy')
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', limit: 1.2)
+ end
end
end if defined?(Fiddle)