diff options
author | tenderlove <tenderlove@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-12-07 00:49:09 +0000 |
---|---|---|
committer | tenderlove <tenderlove@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-12-07 00:49:09 +0000 |
commit | 753de85e40bf400f4cabeee07ab6923bb6e466b9 (patch) | |
tree | dc43acb6c808695125418670055b54cc6cb8375a /test/dl | |
parent | 241cd8c72bae01e042743b53d421412c2cbc8ac3 (diff) | |
download | ruby-753de85e40bf400f4cabeee07ab6923bb6e466b9.tar.gz |
* 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
Diffstat (limited to 'test/dl')
-rw-r--r-- | test/dl/test_callback.rb | 11 | ||||
-rw-r--r-- | test/dl/test_func.rb | 12 |
2 files changed, 23 insertions, 0 deletions
diff --git a/test/dl/test_callback.rb b/test/dl/test_callback.rb index 458625b3a6..844e8f543a 100644 --- a/test/dl/test_callback.rb +++ b/test/dl/test_callback.rb @@ -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 diff --git a/test/dl/test_func.rb b/test/dl/test_func.rb index 99953a448e..5503f350c8 100644 --- a/test/dl/test_func.rb +++ b/test/dl/test_func.rb @@ -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]) |