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

ruby-changes:13676

From: tenderlove <ko1@a...>
Date: Sun, 25 Oct 2009 09:11:41 +0900 (JST)
Subject: [ruby-changes:13676] Ruby:r25461 (trunk): * ext/dl/handle.c (**) adding documentation

tenderlove	2009-10-25 09:11:29 +0900 (Sun, 25 Oct 2009)

  New Revision: 25461

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

  Log:
    * ext/dl/handle.c (**) adding documentation
    * test/dl/test_handle.rb (**) testing to_i and initialize

  Modified files:
    trunk/ext/dl/handle.c
    trunk/test/dl/test_handle.rb

Index: ext/dl/handle.c
===================================================================
--- ext/dl/handle.c	(revision 25460)
+++ ext/dl/handle.c	(revision 25461)
@@ -100,6 +100,13 @@
     return obj;
 }
 
+/*
+ * call-seq:
+ *    initialize(lib = nil, flags = DL::RTLD_LAZY | DL::RTLD_GLOBAL)
+ *
+ * Create a new handler that opens library named +lib+ with +flags+.  If no
+ * library is specified, RTLD_DEFAULT is used.
+ */
 VALUE
 rb_dlhandle_initialize(int argc, VALUE argv[], VALUE self)
 {
@@ -194,6 +201,11 @@
     return Qnil;
 }
 
+/*
+ * call-seq: to_i
+ *
+ * Returns the memory address for this handle.
+ */
 VALUE
 rb_dlhandle_to_i(VALUE self)
 {
Index: test/dl/test_handle.rb
===================================================================
--- test/dl/test_handle.rb	(revision 25460)
+++ test/dl/test_handle.rb	(revision 25461)
@@ -2,6 +2,11 @@
 
 module DL
   class TestHandle < TestBase
+    def test_to_i
+      handle = DL::Handle.new(LIBC_SO)
+      assert handle.to_i
+    end
+
     def test_static_sym_secure
       assert_raises(SecurityError) do
         Thread.new do
@@ -90,5 +95,15 @@
         end.join
       end
     end
+
+    def test_initialize_noargs
+      handle = DL::Handle.new
+      assert handle['rb_str_new']
+    end
+
+    def test_initialize_flags
+      handle = DL::Handle.new(LIBC_SO, DL::RTLD_LAZY | DL::RTLD_GLOBAL)
+      assert handle['calloc']
+    end
   end
 end

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

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