diff options
author | tenderlove <tenderlove@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-10-31 21:13:09 +0000 |
---|---|---|
committer | tenderlove <tenderlove@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-10-31 21:13:09 +0000 |
commit | 07308c4d30b8c5260e5366c8eed2abf054d86fe7 (patch) | |
tree | 0444881bba7151db3ff7e6776404cfc1643a8383 /test/dl/test_cfunc.rb | |
parent | 88326272bc079cd0f47759e02e174f9ff1a73774 (diff) | |
download | ruby-07308c4d30b8c5260e5366c8eed2abf054d86fe7.tar.gz |
* ext/dl/*: remove DL as it is replaced by Fiddle.
[Feature #5458] Thanks to Jonan Scheffler <jonanscheffler@gmail.com>
for this patch
* test/dl/*: ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48217 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/dl/test_cfunc.rb')
-rw-r--r-- | test/dl/test_cfunc.rb | 80 |
1 files changed, 0 insertions, 80 deletions
diff --git a/test/dl/test_cfunc.rb b/test/dl/test_cfunc.rb deleted file mode 100644 index 39fa8133a2..0000000000 --- a/test/dl/test_cfunc.rb +++ /dev/null @@ -1,80 +0,0 @@ -require_relative 'test_base' -require 'dl/func' - -module DL - class TestCFunc < TestBase - def setup - super - @name = 'strcpy' - @cf = CFunc.new(@libc[@name], TYPE_VOIDP, @name) - end - - def test_ptr= - @cf.ptr = @libc['malloc'] - assert_equal @cf.ptr, @libc['malloc'] - end - - def test_ptr - assert_equal @cf.ptr, @libc[@name] - end - - def test_set_calltype - @cf.calltype = :foo - assert_equal :foo, @cf.calltype - end - - def test_new_ptr_type_name - assert_equal @name, @cf.name - assert @cf.name.tainted?, 'name should be tainted' - assert_equal :cdecl, @cf.calltype - assert_equal TYPE_VOIDP, @cf.ctype - end - - def test_new_ptr - cf = CFunc.new(@libc['strcpy']) - assert_nil cf.name - assert_equal :cdecl, cf.calltype - assert_equal TYPE_VOID, cf.ctype - end - - def test_name_should_be_duped - assert_equal @name, @cf.name - assert @cf.name.tainted?, 'name should be tainted' - - name = @name.dup - @name << 'foo' - - assert_equal name, @cf.name - end - - def test_to_s - s = @cf.to_s - assert s.tainted?, 'to_s should be tainted' - assert_match(/ptr=#{sprintf("0x0*%x", @cf.ptr)}/, s) - assert_match(/name='#{@cf.name}'/, s) - assert_match(/type=#{@cf.ctype}/, s) - end - - def test_inspect - assert_equal @cf.inspect, @cf.to_s - end - - def test_inspect_is_tainted - assert @cf.inspect.tainted?, 'inspect is tainted' - end - - def test_to_i - assert_equal @cf.to_i, @cf.ptr - assert_equal @libc[@name], @cf.to_i - end - - def test_last_error - Thread.new do - f = Function.new(@cf, [TYPE_VOIDP, TYPE_VOIDP]) - assert_nil CFunc.last_error - f.call("000", "123") - assert_not_nil CFunc.last_error - end.join - end - end -end |