diff options
author | tenderlove <tenderlove@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-11-06 18:29:31 +0000 |
---|---|---|
committer | tenderlove <tenderlove@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-11-06 18:29:31 +0000 |
commit | 105461551ff0abc6531486cabba413e62dd2e622 (patch) | |
tree | e2fd2610cf0abf8648d6926c93e1994a6845749a /test | |
parent | 0bbaa567b8e6ce2059b1d28f42cb2be12c3e3a80 (diff) | |
download | ruby-105461551ff0abc6531486cabba413e62dd2e622.tar.gz ruby-105461551ff0abc6531486cabba413e62dd2e622.tar.xz ruby-105461551ff0abc6531486cabba413e62dd2e622.zip |
* ext/dl/cptr.c (rb_dlptr_to_str, rb_dlptr_to_s) adding documentation
* test/dl/test_cptr.rb (test_to_str, test_to_s) testing the
stringification of DL::Ptr
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@25677 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r-- | test/dl/test_cptr.rb | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/test/dl/test_cptr.rb b/test/dl/test_cptr.rb index 43605f84c..979c5f50b 100644 --- a/test/dl/test_cptr.rb +++ b/test/dl/test_cptr.rb @@ -3,6 +3,28 @@ require_relative '../ruby/envutil' module DL class TestCPtr < TestBase + def test_to_str + str = "hello world" + ptr = CPtr[str] + + assert_equal 3, ptr.to_str(3).length + assert_equal str, ptr.to_str + + ptr[5] = 0 + assert_equal "hello\0world", ptr.to_str + end + + def test_to_s + str = "hello world" + ptr = CPtr[str] + + assert_equal 3, ptr.to_s(3).length + assert_equal str, ptr.to_s + + ptr[5] = 0 + assert_equal 'hello', ptr.to_s + end + def test_minus str = "hello world" ptr = CPtr[str] |