diff options
author | usa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-12-20 09:36:33 +0000 |
---|---|---|
committer | usa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-12-20 09:36:33 +0000 |
commit | e85d6f8bf96adf655627d82888527e572e030f11 (patch) | |
tree | 54fb3be0c7424b3f3b60334bf0787e11c12d81e3 /test | |
parent | 3f084cde2b5306d2928b6d87676c5477fd30e492 (diff) |
merge revision(s) 38211: [Backport #7516]
* 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/branches/ruby_1_9_3@38502 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-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 761ae43143..819e3eb952 100644 --- a/test/dl/test_func.rb +++ b/test/dl/test_func.rb @@ -9,6 +9,14 @@ module DL assert_equal 'strcpy', f.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]) |