From c4c02d3bdd9cecf03667f2e6d152300eb7678e48 Mon Sep 17 00:00:00 2001 From: Jérémy Zurcher Date: Thu, 12 May 2011 11:32:03 +0200 Subject: add REinaList#from_a --- spec/eina_list_spec.rb | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'spec') diff --git a/spec/eina_list_spec.rb b/spec/eina_list_spec.rb index 0cf2501..a51b148 100644 --- a/spec/eina_list_spec.rb +++ b/spec/eina_list_spec.rb @@ -79,7 +79,7 @@ describe Efl::EinaList do l.free end # - it "should be able to build from ruby Array" do + it "should be able to build from a ruby Array of pointers" do a = [] a << ::FFI::MemoryPointer.from_string("D0") a << ::FFI::MemoryPointer.from_string("D1") @@ -92,6 +92,15 @@ describe Efl::EinaList do l.free end # + it "should be able to build from a ruby Array of int" do + a = [3,4,5,6] + l = REinaList.from_a a, :int + 0.upto 3 do |i| + l.nth(i).read_int.should == i+3 + end + l.free + end + # it "Enumerable" do l = REinaList.new d1 = ::FFI::MemoryPointer.from_string "D0" -- cgit v1.2.3