diff options
| author | ttate <ttate@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2005-03-08 11:31:20 +0000 |
|---|---|---|
| committer | ttate <ttate@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2005-03-08 11:31:20 +0000 |
| commit | 5095cc0c1d2b3beef5c40d23e13f45cb9cfbb50d (patch) | |
| tree | 0a9e4e0e594d75f917f029122a294a074a317c36 /ext/dl/test | |
| parent | 8a11e856f1c025c6f3d05c4792611fdd7272205e (diff) | |
| download | ruby-5095cc0c1d2b3beef5c40d23e13f45cb9cfbb50d.tar.gz ruby-5095cc0c1d2b3beef5c40d23e13f45cb9cfbb50d.tar.xz ruby-5095cc0c1d2b3beef5c40d23e13f45cb9cfbb50d.zip | |
changed the spec of CPtr#[]/[]= to suit String#[]/[]=.
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@8123 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/dl/test')
| -rw-r--r-- | ext/dl/test/test_dl2.rb | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/ext/dl/test/test_dl2.rb b/ext/dl/test/test_dl2.rb index d1b18057c..e59956cf7 100644 --- a/ext/dl/test/test_dl2.rb +++ b/ext/dl/test/test_dl2.rb @@ -85,5 +85,27 @@ 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], ptr[0]) + assert_equal(str[1], ptr[1]) + } + str = 'abc' + ptr = CPtr[str] + check.call(str, ptr) + str[0] = ?c + ptr[0] = ?c + check.call(str, ptr) + str[0,2] = "aa" + ptr[0,2] = "aa" + check.call(str, ptr) + end end end # module DL |
