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

ruby-changes:14656

From: yugui <ko1@a...>
Date: Sat, 30 Jan 2010 22:07:12 +0900 (JST)
Subject: [ruby-changes:14656] Ruby:r26504 (ruby_1_9_1): merges tests from trunk@25460 into ruby_1_9_1.

yugui	2010-01-30 21:52:57 +0900 (Sat, 30 Jan 2010)

  New Revision: 26504

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

  Log:
    merges tests from trunk@25460 into ruby_1_9_1.
    --
    * ext/dl/handle.c (rb_dlhandle_sym) refactoring rb_secure(2)
    * test/dl/test_handle.rb (**) testing sym behavior

  Modified files:
    branches/ruby_1_9_1/test/dl/test_handle.rb
    branches/ruby_1_9_1/version.h

Index: ruby_1_9_1/version.h
===================================================================
--- ruby_1_9_1/version.h	(revision 26503)
+++ ruby_1_9_1/version.h	(revision 26504)
@@ -1,5 +1,5 @@
 #define RUBY_VERSION "1.9.1"
-#define RUBY_PATCHLEVEL 409
+#define RUBY_PATCHLEVEL 410
 #define RUBY_VERSION_MAJOR 1
 #define RUBY_VERSION_MINOR 9
 #define RUBY_VERSION_TEENY 1
Index: ruby_1_9_1/test/dl/test_handle.rb
===================================================================
--- ruby_1_9_1/test/dl/test_handle.rb	(revision 26503)
+++ ruby_1_9_1/test/dl/test_handle.rb	(revision 26504)
@@ -2,6 +2,52 @@
 
 module DL
   class TestHandle < TestBase
+    def test_sym_closed_handle
+      handle = DL::Handle.new(LIBC_SO)
+      handle.close
+      assert_raises(DL::DLError) { handle.sym("calloc") }
+      assert_raises(DL::DLError) { handle["calloc"] }
+    end
+
+    def test_sym_unknown
+      handle = DL::Handle.new(LIBC_SO)
+      assert_raises(DL::DLError) { handle.sym('fooo') }
+      assert_raises(DL::DLError) { handle['fooo'] }
+    end
+
+    def test_sym_with_bad_args
+      handle = DL::Handle.new(LIBC_SO)
+      assert_raises(TypeError) { handle.sym(nil) }
+      assert_raises(TypeError) { handle[nil] }
+    end
+
+    def test_sym_secure
+      assert_raises(SecurityError) do
+        Thread.new do
+          $SAFE = 2
+          handle = DL::Handle.new(LIBC_SO)
+          handle.sym('calloc')
+        end.join
+      end
+    end
+
+    def test_sym
+      handle = DL::Handle.new(LIBC_SO)
+      assert handle.sym('calloc')
+      assert handle['calloc']
+    end
+
+    def test_handle_close
+      handle = DL::Handle.new(LIBC_SO)
+      assert_equal 0, handle.close
+    end
+
+    def test_handle_close_twice
+      handle = DL::Handle.new(LIBC_SO)
+      handle.close
+      handle.close rescue DL::DLError
+    end
+
     def test_dlopen_returns_handle
       assert_instance_of DL::Handle, dlopen(LIBC_SO)
     end

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

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