diff options
author | kou <kou@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-12-21 14:16:02 +0000 |
---|---|---|
committer | kou <kou@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-12-21 14:16:02 +0000 |
commit | 8346f7b2ad3138bdc30c8b39c8de13f3b392c059 (patch) | |
tree | 2812a9812d5b2a78b21dc2279b0b15a9107461fc /test/fiddle | |
parent | e852838cee777cfc9c6e3f8f16142d4809422179 (diff) | |
download | ruby-8346f7b2ad3138bdc30c8b39c8de13f3b392c059.tar.gz |
* ext/fiddle/lib/fiddle/struct.rb (Fiddle::CStructEntity#set_ctypes):
CPtr -> Pointer.
* test/fiddle/test_c_struct_entry.rb
(Fiddle::TestCStructEntity#test_aref_pointer):
Added the test for the above.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38538 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/fiddle')
-rw-r--r-- | test/fiddle/test_c_struct_entry.rb | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/test/fiddle/test_c_struct_entry.rb b/test/fiddle/test_c_struct_entry.rb index 3a5faefabc..a6cee75eb9 100644 --- a/test/fiddle/test_c_struct_entry.rb +++ b/test/fiddle/test_c_struct_entry.rb @@ -61,5 +61,14 @@ module Fiddle team["names"] = [alice, bob] assert_equal(["Alice", "Bob"], team["names"].map(&:to_s)) end + + def test_aref_pointer + user = CStructEntity.malloc([TYPE_VOIDP]) + user.assign_names(["name"]) + alice = Fiddle::Pointer.malloc(6) + alice[0, 6] = "Alice\0" + user["name"] = alice + assert_equal("Alice", user["name"].to_s) + end end end |