1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* ext/dl/cptr.c (to_int): DL::CPtr supports to_int

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25996 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
tenderlove 2009-12-04 23:21:01 +00:00
parent beb486d55e
commit 6a1aebaabf
2 changed files with 6 additions and 0 deletions

View file

@ -626,6 +626,7 @@ Init_dlptr(void)
rb_define_method(rb_cDLCPtr, "free=", rb_dlptr_free_set, 1);
rb_define_method(rb_cDLCPtr, "free", rb_dlptr_free_get, 0);
rb_define_method(rb_cDLCPtr, "to_i", rb_dlptr_to_i, 0);
rb_define_method(rb_cDLCPtr, "to_int", rb_dlptr_to_i, 0);
rb_define_method(rb_cDLCPtr, "to_value", rb_dlptr_to_value, 0);
rb_define_method(rb_cDLCPtr, "ptr", rb_dlptr_ptr, 0);
rb_define_method(rb_cDLCPtr, "+@", rb_dlptr_ptr, 0);

View file

@ -3,6 +3,11 @@ require_relative '../ruby/envutil'
module DL
class TestCPtr < TestBase
def test_cptr_to_int
null = DL::NULL
assert_equal(null.to_i, null.to_int)
end
def test_malloc_free_func_int
free = CFunc.new(DL::RUBY_FREE, TYPE_VOID, 'free')