diff options
author | tenderlove <tenderlove@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-10-25 00:11:02 +0000 |
---|---|---|
committer | tenderlove <tenderlove@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-10-25 00:11:02 +0000 |
commit | fef55edeecbe78b34f89347016b41ea9f06aad1a (patch) | |
tree | d2274f6b55ad860e2ef4690a1ee846c16f5c06b7 /test | |
parent | 886c186d02c12b7a934bd1033d1c96f0accc93a8 (diff) | |
download | ruby-fef55edeecbe78b34f89347016b41ea9f06aad1a.tar.gz ruby-fef55edeecbe78b34f89347016b41ea9f06aad1a.tar.xz ruby-fef55edeecbe78b34f89347016b41ea9f06aad1a.zip |
* ext/dl/handle.c (rb_dlhandle_sym) removing unnecessary code. Adding
documentation and tests for current functionality.
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@25459 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r-- | test/dl/test_handle.rb | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/test/dl/test_handle.rb b/test/dl/test_handle.rb index fed9da4f8..59582e96b 100644 --- a/test/dl/test_handle.rb +++ b/test/dl/test_handle.rb @@ -2,6 +2,31 @@ 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 + 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 |