[前][次][番号順一覧][スレッド一覧]

ruby-changes:13809

From: tenderlove <ko1@a...>
Date: Sun, 1 Nov 2009 10:47:04 +0900 (JST)
Subject: [ruby-changes:13809] Ruby:r25607 (trunk): * ext/dl/cptr.c (rb_dlptr_to_value) added documentation

tenderlove	2009-11-01 10:46:56 +0900 (Sun, 01 Nov 2009)

  New Revision: 25607

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=25607

  Log:
    * ext/dl/cptr.c (rb_dlptr_to_value) added documentation
    * test/dl/test_cptr.rb (test_to_value) testing DL::CPtr#to_value

  Modified files:
    trunk/ext/dl/cptr.c
    trunk/test/dl/test_cptr.rb

Index: ext/dl/cptr.c
===================================================================
--- ext/dl/cptr.c	(revision 25606)
+++ ext/dl/cptr.c	(revision 25607)
@@ -197,6 +197,11 @@
     return PTR2NUM(data->ptr);
 }
 
+/*
+ * call-seq: to_value
+ *
+ * Cast this CPtr to a ruby object.
+ */
 VALUE
 rb_dlptr_to_value(VALUE self)
 {
Index: test/dl/test_cptr.rb
===================================================================
--- test/dl/test_cptr.rb	(revision 25606)
+++ test/dl/test_cptr.rb	(revision 25607)
@@ -3,6 +3,12 @@
 
 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

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]