From 6ce6c87d5151f5bb60fc26409a22c8005dc46660 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Zurcher?= Date: Tue, 3 May 2011 22:49:23 +0200 Subject: REinaList : simple spec for Enumerable --- spec/eina_list_spec.rb | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/spec/eina_list_spec.rb b/spec/eina_list_spec.rb index 96ac7bd..d19a372 100644 --- a/spec/eina_list_spec.rb +++ b/spec/eina_list_spec.rb @@ -92,4 +92,20 @@ describe Efl::EinaList do l.free end # + it "Enumerable should work" 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 + r = 0 + l.each do |e| r+=1; end + r.should == 4 + r = l.inject(0) do |s,e| s+=1; s; end + r.should == 4 + end end -- cgit v1.1-2-g2b99