mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* ext/dl/cptr.c (rb_dlptr_to_value) added documentation
* test/dl/test_cptr.rb (test_to_value) testing DL::CPtr#to_value git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25607 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
6cf6d8556c
commit
4b76900a55
2 changed files with 11 additions and 0 deletions
|
@ -197,6 +197,11 @@ rb_dlptr_to_i(VALUE self)
|
|||
return PTR2NUM(data->ptr);
|
||||
}
|
||||
|
||||
/*
|
||||
* call-seq: to_value
|
||||
*
|
||||
* Cast this CPtr to a ruby object.
|
||||
*/
|
||||
VALUE
|
||||
rb_dlptr_to_value(VALUE self)
|
||||
{
|
||||
|
|
|
@ -3,6 +3,12 @@ require_relative '../ruby/envutil'
|
|||
|
||||
module DL
|
||||
class TestCPtr < TestBase
|
||||
def test_to_value
|
||||
ary = [0,1,2,4,5]
|
||||
addr = CPtr.new(dlwrap(ary))
|
||||
assert_equal ary, addr.to_value
|
||||
end
|
||||
|
||||
def test_free
|
||||
ptr = CPtr.malloc(4)
|
||||
assert_nil ptr.free
|
||||
|
|
Loading…
Reference in a new issue