summaryrefslogtreecommitdiff
path: root/test/dl/test_handle.rb
diff options
context:
space:
mode:
Diffstat (limited to 'test/dl/test_handle.rb')
-rw-r--r--test/dl/test_handle.rb27
1 files changed, 27 insertions, 0 deletions
diff --git a/test/dl/test_handle.rb b/test/dl/test_handle.rb
new file mode 100644
index 0000000000..d46e16c084
--- /dev/null
+++ b/test/dl/test_handle.rb
@@ -0,0 +1,27 @@
+require 'test_base'
+
+module DL
+ class TestHandle < TestBase
+ 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