зеркало из https://github.com/github/ruby.git
* 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:
Родитель
241cd8c72b
Коммит
753de85e40
|
@ -7,6 +7,17 @@ module DL
|
|||
class TestCallback < TestBase
|
||||
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
|
||||
addr = set_callback(TYPE_VOIDP, 1) do |str|
|
||||
str
|
||||
|
|
|
@ -3,6 +3,18 @@ require 'dl/func'
|
|||
|
||||
module DL
|
||||
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()
|
||||
f = Function.new(CFunc.new(@libc['strcpy'], TYPE_VOIDP, 'strcpy'),
|
||||
[TYPE_VOIDP, TYPE_VOIDP])
|
||||
|
|
Загрузка…
Ссылка в новой задаче