mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* test/dl/test_callback.rb testing callback removal
* test/dl/test_func.rb testing function names, to_i git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26037 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
241cd8c72b
commit
753de85e40
2 changed files with 23 additions and 0 deletions
|
@ -7,6 +7,17 @@ module DL
|
||||||
class TestCallback < TestBase
|
class TestCallback < TestBase
|
||||||
include DL
|
include DL
|
||||||
|
|
||||||
|
def test_remove_callback_failed
|
||||||
|
assert_equal(false, remove_callback(0, TYPE_VOIDP))
|
||||||
|
end
|
||||||
|
|
||||||
|
def test_remove_callback
|
||||||
|
addr = set_callback(TYPE_VOIDP, 1) do |str|
|
||||||
|
str
|
||||||
|
end
|
||||||
|
assert remove_callback(addr, TYPE_VOIDP), 'callback removed'
|
||||||
|
end
|
||||||
|
|
||||||
def test_callback_return_value
|
def test_callback_return_value
|
||||||
addr = set_callback(TYPE_VOIDP, 1) do |str|
|
addr = set_callback(TYPE_VOIDP, 1) do |str|
|
||||||
str
|
str
|
||||||
|
|
|
@ -3,6 +3,18 @@ require 'dl/func'
|
||||||
|
|
||||||
module DL
|
module DL
|
||||||
class TestFunc < TestBase
|
class TestFunc < TestBase
|
||||||
|
def test_name
|
||||||
|
f = Function.new(CFunc.new(@libc['strcpy'], TYPE_VOIDP, 'strcpy'),
|
||||||
|
[TYPE_VOIDP, TYPE_VOIDP])
|
||||||
|
assert_equal 'strcpy', f.name
|
||||||
|
end
|
||||||
|
|
||||||
|
def test_to_i
|
||||||
|
cfunc = CFunc.new(@libc['strcpy'], TYPE_VOIDP, 'strcpy')
|
||||||
|
f = Function.new(cfunc, [TYPE_VOIDP, TYPE_VOIDP])
|
||||||
|
assert_equal cfunc.to_i, f.to_i
|
||||||
|
end
|
||||||
|
|
||||||
def test_strcpy()
|
def test_strcpy()
|
||||||
f = Function.new(CFunc.new(@libc['strcpy'], TYPE_VOIDP, 'strcpy'),
|
f = Function.new(CFunc.new(@libc['strcpy'], TYPE_VOIDP, 'strcpy'),
|
||||||
[TYPE_VOIDP, TYPE_VOIDP])
|
[TYPE_VOIDP, TYPE_VOIDP])
|
||||||
|
|
Loading…
Reference in a new issue