From f1841f43eb9d7ec45bcbee7f70abae77d999f76d Mon Sep 17 00:00:00 2001 From: ngoto Date: Wed, 5 Dec 2012 03:20:05 +0000 Subject: * ext/dl/lib/dl/func.rb (DL::Function#initialize, DL::Function#bind): ABI should be set by using CFunc#calltype even when Fiddle is used. When Fiddle is used and a block is given, name shoud not be ignored. [ruby-core:50562] [Bug #7514] * ext/dl/lib/dl/import.rb (DL::Importer#bind_function): should respect abi and name when Fiddle is used. * test/dl/test_func.rb (test_name_with_block): test for "name" method with giving a block. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38202 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/dl/test_func.rb | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'test/dl') diff --git a/test/dl/test_func.rb b/test/dl/test_func.rb index 021ea36d25..514ed6c6c2 100644 --- a/test/dl/test_func.rb +++ b/test/dl/test_func.rb @@ -9,6 +9,12 @@ module DL assert_equal 'strcpy', f.name end + def test_name_with_block + cb = Function.new(CFunc.new(0, TYPE_INT, 'qsort'), + [TYPE_VOIDP, TYPE_VOIDP]){|x,y| CPtr.new(x)[0] <=> CPtr.new(y)[0]} + assert_equal('qsort', cb.name) + end + def test_to_i cfunc = CFunc.new(@libc['strcpy'], TYPE_VOIDP, 'strcpy') f = Function.new(cfunc, [TYPE_VOIDP, TYPE_VOIDP]) -- cgit v1.2.3