diff options
author | tenderlove <tenderlove@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-11-01 01:46:44 +0000 |
---|---|---|
committer | tenderlove <tenderlove@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-11-01 01:46:44 +0000 |
commit | 3fdf73f236d5a8816df18bf7dbdbd66610d3e427 (patch) | |
tree | 7dc20b7c1b92b1672d1eb806f8d87ff4993bb78f /test/dl/test_dl2.rb | |
parent | 7030430fcbf5730dd1b661b1a49228cfca805dc9 (diff) | |
download | ruby-3fdf73f236d5a8816df18bf7dbdbd66610d3e427.tar.gz ruby-3fdf73f236d5a8816df18bf7dbdbd66610d3e427.tar.xz ruby-3fdf73f236d5a8816df18bf7dbdbd66610d3e427.zip |
* ext/dl/cptr.c (rb_dlptr_size) splitting function to reduce complexity
* ext/dl/cptr.c (rb_dlptr_null_p, rb_dlptr_aref, rb_dlptr_aset) adding
documentation
* ext/dl/dl.c (rb_dl_free) adding documentation
* test/dl/test_cptr.rb (test_null?, test_size, test_size=,
test_aref_aset) Improving test coverage
* test/dl/test_dl2.rb (test_free_secure) improving test coverage
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@25606 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/dl/test_dl2.rb')
-rw-r--r-- | test/dl/test_dl2.rb | 31 |
1 files changed, 9 insertions, 22 deletions
diff --git a/test/dl/test_dl2.rb b/test/dl/test_dl2.rb index d391e976e..ac1414920 100644 --- a/test/dl/test_dl2.rb +++ b/test/dl/test_dl2.rb @@ -5,6 +5,15 @@ module DL class TestDL < TestBase # TODO: refactor test repetition + def test_free_secure + assert_raises(SecurityError) do + Thread.new do + $SAFE = 4 + DL.free(0) + end.join + end + end + def test_realloc str = "abc" ptr_id = DL.realloc(0, 4) @@ -133,27 +142,5 @@ class TestDL < TestBase ary2 = dlunwrap(addr) assert_equal(ary, ary2) end - - def test_cptr() - check = Proc.new{|str,ptr| - assert_equal(str.size(), ptr.size()) - assert_equal(str, ptr.to_s()) - assert_equal(str[0,2], ptr.to_s(2)) - assert_equal(str[0,2], ptr[0,2]) - assert_equal(str[1,2], ptr[1,2]) - assert_equal(str[1,0], ptr[1,0]) - assert_equal(str[0].ord, ptr[0]) - assert_equal(str[1].ord, ptr[1]) - } - str = 'abc' - ptr = CPtr[str] - check.call(str, ptr) - str[0] = "c" - ptr[0] = "c".ord - check.call(str, ptr) - str[0,2] = "aa" - ptr[0,2] = "aa" - check.call(str, ptr) - end end end # module DL |