summaryrefslogtreecommitdiffstats
path: root/spec
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2011-05-12 11:59:03 +0200
committerJérémy Zurcher <jeremy@asynk.ch>2011-05-12 11:59:03 +0200
commita24f87f291e33b94844188fe9893975e44dc5ff2 (patch)
treeed2e7ce49a18a3fcdfbb128bd2e27634bf77f826 /spec
parentc4c02d3bdd9cecf03667f2e6d152300eb7678e48 (diff)
downloadffi-efl-a24f87f291e33b94844188fe9893975e44dc5ff2.zip
ffi-efl-a24f87f291e33b94844188fe9893975e44dc5ff2.tar.gz
add ptrt parameter to REinaList#to_a
Diffstat (limited to 'spec')
-rw-r--r--spec/eina_list_spec.rb22
1 files changed, 20 insertions, 2 deletions
diff --git a/spec/eina_list_spec.rb b/spec/eina_list_spec.rb
index a51b148..230e9bb 100644
--- a/spec/eina_list_spec.rb
+++ b/spec/eina_list_spec.rb
@@ -38,7 +38,7 @@ describe Efl::EinaList do
end
#
it "should be able to convert into ruby Array from empty REinaList" do
- ary = REinaList.new.to_ary
+ ary = REinaList.new.to_a
ary.empty?.should be_true
ary.is_a?(Array).should be_true
end
@@ -71,7 +71,7 @@ describe Efl::EinaList do
l.prepend d2
l << d4
l.unshift d1
- ary = l.to_ary
+ ary = l.to_a
ary.length.should == 4
0.upto 3 do |i|
ary[i].read_string.should == "D#{i}"
@@ -79,6 +79,24 @@ describe Efl::EinaList do
l.free
end
#
+ it "should be able to convert into ruby Array from non empty REinaList pointer" do
+ l = REinaList.new
+ d1 = ::FFI::MemoryPointer.from_string "D0"
+ d2 = ::FFI::MemoryPointer.from_string "D1"
+ d3 = ::FFI::MemoryPointer.from_string "D2"
+ d4 = ::FFI::MemoryPointer.from_string "D3"
+ l.append d3
+ l.prepend d2
+ l << d4
+ l.unshift d1
+ ary = l.to_a :string
+ ary.length.should == 4
+ 0.upto 3 do |i|
+ ary[i].should == "D#{i}"
+ end
+ l.free
+ end
+ #
it "should be able to build from a ruby Array of pointers" do
a = []
a << ::FFI::MemoryPointer.from_string("D0")