mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* 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
This commit is contained in:
parent
e852838cee
commit
8346f7b2ad
3 changed files with 18 additions and 1 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue