summaryrefslogtreecommitdiff
path: root/test/dl
diff options
context:
space:
mode:
authornagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-08-30 13:39:31 +0000
committernagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-08-30 13:39:31 +0000
commit527be1b25a3192fffa143ef4bb520c9812e8324d (patch)
tree6a435936220482d699e87f78144d7d5bfa24bd06 /test/dl
parent13d3a16ada7e154647d9abdc203e3b19ee328ccd (diff)
* test/dl/test_callback.rb (test_callback_with_string): prevents
temporary string from GC. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33127 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/dl')
-rw-r--r--test/dl/test_callback.rb7
1 files changed, 5 insertions, 2 deletions
diff --git a/test/dl/test_callback.rb b/test/dl/test_callback.rb
index ed3be661e7..fb24ff0ca5 100644
--- a/test/dl/test_callback.rb
+++ b/test/dl/test_callback.rb
@@ -48,8 +48,11 @@ module DL
func = CFunc.new(addr, TYPE_VOID, 'test')
f = Function.new(func, [TYPE_VOIDP])
- f.call(dlwrap('foo'))
- assert_equal 'foo', called_with
+ # Don't remove local variable arg.
+ # This necessary to protect objects from GC.
+ arg = 'foo'
+ f.call(dlwrap(arg))
+ assert_equal arg, called_with
end
def test_call_callback