summaryrefslogtreecommitdiffstats
path: root/spec
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy.zurcher@heraeus.com>2011-04-12 14:14:31 +0200
committerJérémy Zurcher <jeremy.zurcher@heraeus.com>2011-04-12 14:14:31 +0200
commitb95723834ba5bdcb85e90760bba8fc26574e7ff3 (patch)
tree8b829d99a2e18ec7d0f557aaaebb60348912b480 /spec
parent0c3cbdb988566ea3e2dcd52396b834cbab02d3fa (diff)
downloadffi-efl-b95723834ba5bdcb85e90760bba8fc26574e7ff3.zip
ffi-efl-b95723834ba5bdcb85e90760bba8fc26574e7ff3.tar.gz
update ecore + spec with ecore_pipe, ...
Diffstat (limited to 'spec')
-rw-r--r--spec/ecore_spec.rb23
1 files changed, 21 insertions, 2 deletions
diff --git a/spec/ecore_spec.rb b/spec/ecore_spec.rb
index e1260fc..8d7f4bf 100644
--- a/spec/ecore_spec.rb
+++ b/spec/ecore_spec.rb
@@ -20,8 +20,27 @@ describe EFL::ECORE do
end
#
it "should run a single iteration of the mainloop" do
- ECORE.init.should eql 1
+ ECORE.init
ECORE.main_loop_iterate
- ECORE.shutdown.should eql 0
+ ECORE.shutdown
+ end
+ #
+ it 'should write and read data from pipe' do
+ ECORE.init
+ cb = Proc.new do |data,buffer,bytes|
+ data.read_string.should eql 'none'
+ buffer.read_string.should eql 'hello world'
+ bytes.should eql 12
+ end
+ data = FFI::MemoryPointer.from_string("none")
+ pipe = ECORE.pipe_add cb, data
+ buffer = FFI::MemoryPointer.new(:string,128)
+ buffer.write_string 'hello world'
+ ECORE.pipe_write pipe, buffer, 12
+ ECORE.main_loop_iterate
+ ECORE.pipe_read_close pipe
+ ECORE.pipe_write_close pipe
+ ECORE.pipe_del pipe
+ ECORE.shutdown
end
end