summaryrefslogtreecommitdiffstats
path: root/test/dl/test_cptr.rb
diff options
context:
space:
mode:
authoryugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-10-31 13:04:48 +0000
committeryugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-10-31 13:04:48 +0000
commit2a9ff4d18895f7bea96847b46f04fa9489432beb (patch)
tree35121f2b45b843431710e1bf55646cec4bf965ae /test/dl/test_cptr.rb
parentf4541891139175bc4d33aff932ce5285605794d8 (diff)
merges r24785 and r24833 from trunk into ruby_1_9_1, with small modification.
-- * test/dl/test_{cfunc,ptr}.rb: added tests from Aaron Patterson. see [ruby-dev:39249]. git-svn-id: http://svn.ruby-lang.org/repos/ruby/branches/ruby_1_9_1@25591 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/dl/test_cptr.rb')
-rw-r--r--test/dl/test_cptr.rb18
1 files changed, 18 insertions, 0 deletions
diff --git a/test/dl/test_cptr.rb b/test/dl/test_cptr.rb
new file mode 100644
index 000000000..2d6a08e1c
--- /dev/null
+++ b/test/dl/test_cptr.rb
@@ -0,0 +1,18 @@
+require_relative 'test_base'
+
+module DL
+ class TestCPtr < TestBase
+ def test_free
+ ptr = CPtr.malloc(4)
+ assert_nil ptr.free
+ end
+
+ def test_free=
+ free = CFunc.new(@libc['free'], TYPE_VOID, 'free')
+ ptr = CPtr.malloc(4)
+ ptr.free = free
+
+ assert_equal free.ptr, ptr.free.ptr
+ end
+ end
+end