diff options
author | ngoto <ngoto@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-12-05 13:24:19 +0000 |
---|---|---|
committer | ngoto <ngoto@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-12-05 13:24:19 +0000 |
commit | 9920da55936adc025fb65bc00d2973cf0d952d87 (patch) | |
tree | fb4c9bf63a3833713104164c7ee910080ec4f3ac /test/dl/test_func.rb | |
parent | 17a11774ca9bc79609128187e3b6c814bd590ce5 (diff) | |
download | ruby-9920da55936adc025fb65bc00d2973cf0d952d87.tar.gz |
* ext/dl/lib/dl/func.rb (DL::Function#bind): When Fiddle is used,
@ptr should be updated. This fixes SEGV raised in DL::Function#call
after calling DL::Function#bind. [Bug #7516] [ruby-dev:46708]
* test/dl/test_func.rb (test_bind): test for the above
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38211 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/dl/test_func.rb')
-rw-r--r-- | test/dl/test_func.rb | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/test/dl/test_func.rb b/test/dl/test_func.rb index 514ed6c6c2..b1aac15dd2 100644 --- a/test/dl/test_func.rb +++ b/test/dl/test_func.rb @@ -15,6 +15,14 @@ module DL assert_equal('<callback>qsort', cb.name) end + def test_bind + f = Function.new(CFunc.new(0, TYPE_INT, 'test'), [TYPE_INT, TYPE_INT]) + assert_nothing_raised { + f.bind { |x, y| x + y } + } + assert_equal 579, f.call(123, 456) + end + def test_to_i cfunc = CFunc.new(@libc['strcpy'], TYPE_VOIDP, 'strcpy') f = Function.new(cfunc, [TYPE_VOIDP, TYPE_VOIDP]) |