1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00
ruby--ruby/test/dl/test_handle.rb
tenderlove a631b5df36 * ext/dl/handle.c (rb_dlhandle_close) check return value of dlclose()
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25458 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-10-24 21:56:50 +00:00

40 lines
788 B
Ruby

require 'test_base'
module DL
class TestHandle < TestBase
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
assert_raises(DL::DLError) do
handle.close
end
end
def test_dlopen_returns_handle
assert_instance_of DL::Handle, dlopen(LIBC_SO)
end
def test_dlopen_safe
assert_raises(SecurityError) do
Thread.new do
$SAFE = 2
dlopen(LIBC_SO)
end.join
end
end
def test_initialize_safe
assert_raises(SecurityError) do
Thread.new do
$SAFE = 2
DL::Handle.new(LIBC_SO)
end.join
end
end
end
end