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

ruby-changes:13938

From: tenderlove <ko1@a...>
Date: Fri, 13 Nov 2009 07:41:18 +0900 (JST)
Subject: [ruby-changes:13938] Ruby:r25742 (trunk): * ext/dl/cptr.c (rb_dlptr_s_to_ptr): when wrapping a pointer it should

tenderlove	2009-11-13 07:41:07 +0900 (Fri, 13 Nov 2009)

  New Revision: 25742

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

  Log:
    * ext/dl/cptr.c (rb_dlptr_s_to_ptr): when wrapping a pointer it should
      keep a reference to the object it's wrapping
    * test/dl/test_func.rb use standard test methods

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

Index: ext/dl/cptr.c
===================================================================
--- ext/dl/cptr.c	(revision 25741)
+++ ext/dl/cptr.c	(revision 25742)
@@ -608,6 +608,7 @@
 	ptr = rb_dlptr_new(NUM2PTR(rb_Integer(val)), 0, NULL);
     }
     OBJ_INFECT(ptr, val);
+    rb_iv_set(ptr, "wrapping", val);
     return ptr;
 }
 
Index: test/dl/test_func.rb
===================================================================
--- test/dl/test_func.rb	(revision 25741)
+++ test/dl/test_func.rb	(revision 25742)
@@ -36,7 +36,7 @@
       buff1 = CPtr["12.34"]
       buff2 = buff1 + 4
       r = f.call(buff1, buff2)
-      assert_match(12.00..13.00, r)
+      assert_in_delta(12.34, r, 0.001)
     end
 
     def test_qsort1()

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

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