зеркало из https://github.com/github/ruby.git
* 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:
Родитель
e852838cee
Коммит
8346f7b2ad
|
@ -1,3 +1,11 @@
|
|||
Fri Dec 21 23:15:25 2012 Kouhei Sutou <kou@cozmixng.org>
|
||||
|
||||
* 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.
|
||||
|
||||
Fri Dec 21 23:12:05 2012 Kouhei Sutou <kou@cozmixng.org>
|
||||
|
||||
* ext/fiddle/lib/fiddle/struct.rb (Fiddle::CStructEntity#set_ctypes):
|
||||
|
|
|
@ -168,7 +168,7 @@ module Fiddle
|
|||
val = val.collect{|v| Pointer.new(v)}
|
||||
end
|
||||
when TYPE_VOIDP
|
||||
val = CPtr.new(val[0])
|
||||
val = Pointer.new(val[0])
|
||||
else
|
||||
val = val[0]
|
||||
end
|
||||
|
|
|
@ -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
|
||||
|
|
Загрузка…
Ссылка в новой задаче