diff options
author | yugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-01-30 12:52:57 +0000 |
---|---|---|
committer | yugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-01-30 12:52:57 +0000 |
commit | 4d5af95020d069543862acc39dd29fb9c46ea4b6 (patch) | |
tree | 7b77ba79635f22a4030d13e6fe31374e06e4ad1b | |
parent | 0347be3e4b7d42aa25a92df2794ef8f3131cda5b (diff) |
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
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_1@26504 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | test/dl/test_handle.rb | 46 | ||||
-rw-r--r-- | version.h | 2 |
2 files changed, 47 insertions, 1 deletions
diff --git a/test/dl/test_handle.rb b/test/dl/test_handle.rb index d46e16c084..a9d12eab4f 100644 --- a/test/dl/test_handle.rb +++ b/test/dl/test_handle.rb @@ -2,6 +2,52 @@ require 'test_base' 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 @@ -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 |