diff options
author | Jérémy Zurcher <jeremy@asynk.ch> | 2011-04-08 17:59:24 +0200 |
---|---|---|
committer | Jérémy Zurcher <jeremy@asynk.ch> | 2011-04-08 17:59:24 +0200 |
commit | d62833580889816914eebb61ffcfcb26496ea883 (patch) | |
tree | b638b8d17b9d204a8bbb15eb88089f0b68a29c68 /spec | |
download | ffi-efl-d62833580889816914eebb61ffcfcb26496ea883.zip ffi-efl-d62833580889816914eebb61ffcfcb26496ea883.tar.gz |
initial commit
Diffstat (limited to 'spec')
-rw-r--r-- | spec/ecore_spec.rb | 22 | ||||
-rw-r--r-- | spec/eet_spec.rb | 76 |
2 files changed, 98 insertions, 0 deletions
diff --git a/spec/ecore_spec.rb b/spec/ecore_spec.rb new file mode 100644 index 0000000..a2ae2fd --- /dev/null +++ b/spec/ecore_spec.rb @@ -0,0 +1,22 @@ +#! /usr/bin/env ruby +# -*- coding: UTF-8 -*- +# +require 'efl/ecore' +# +describe EFL::ECORE do + # + include EFL + # + it "should init" do + ECORE.init.should eql 1 + ECORE.init.should eql 2 + ECORE.init.should eql 3 + end + # + it "should shutdown" do + ECORE.shutdown.should eql 2 + ECORE.shutdown.should eql 1 + ECORE.shutdown.should eql 0 + end + # +end diff --git a/spec/eet_spec.rb b/spec/eet_spec.rb new file mode 100644 index 0000000..033ae37 --- /dev/null +++ b/spec/eet_spec.rb @@ -0,0 +1,76 @@ +#! /usr/bin/env ruby +# -*- coding: UTF-8 -*- +# +require 'efl/eet' +# +describe EFL::EET do + # + include EFL + # + it "should init" do + EET.init.should eql 1 + EET.init.should eql 2 + EET.init.should eql 3 + end + # + it "should shutdown" do + EET.shutdown.should eql 2 + EET.shutdown.should eql 1 + EET.shutdown.should eql 0 + end + # + it "should clearcache" do + EET.clearcache + EET.clearcache + EET.clearcache + end + # + it "should open and close" do + EET.init.should eql 1 + f = EET.open '/tmp/_eet.cfg', EET::FILE_MODE_WRITE + f.close + EET.shutdown.should eql 0 + end + it "should be able to get file access mode" do + EET.init.should eql 1 + [ EET::FILE_MODE_READ, EET::FILE_MODE_WRITE, EET::FILE_MODE_READ_WRITE ].each do |m| + EET.open '/tmp/_eet.cfg', m do |f| + f.mode_get.should eql m + end + end + EET.shutdown.should eql 0 + end + # + it "should write" do + EET.init.should eql 1 + f = EET.open '/tmp/_eet.cfg', EET::FILE_MODE_WRITE + f.write 'config', 'test key' + f.close + EET.shutdown.should eql 0 + end + # + it "should read" do + EET.init.should eql 1 + f = EET.open '/tmp/_eet.cfg', EET::FILE_MODE_READ + f.read('config').should eql 'test key' + f.close + EET.shutdown.should eql 0 + end + # + it "should write in block" do + EET.init.should eql 1 + EET.open('/tmp/_eet.cfg', EET::FILE_MODE_WRITE) do |f| + f.write 'config2', 'test--key' + end + EET.shutdown.should eql 0 + end + # + it "should read in block" do + EET.init.should eql 1 + EET.open('/tmp/_eet.cfg', EET::FILE_MODE_READ) do |f| + f.read('config2').should eql 'test--key' + end + EET.shutdown.should eql 0 + end + # +end |