summaryrefslogtreecommitdiffstats
path: root/spec
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy.zurcher@heraeus.com>2011-04-19 10:48:25 +0200
committerJérémy Zurcher <jeremy.zurcher@heraeus.com>2011-04-19 10:48:25 +0200
commit46fcb605893e08e5430520f52d5777c43f01b4cc (patch)
tree1a9fbd5115ba26caf992ad2ad64f345697bfcf89 /spec
parent794e67ddb56539fcd94ab2b29fbd2894b53f9066 (diff)
downloadffi-efl-46fcb605893e08e5430520f52d5777c43f01b4cc.zip
ffi-efl-46fcb605893e08e5430520f52d5777c43f01b4cc.tar.gz
eet: generate files, update base classes and specs
Diffstat (limited to 'spec')
-rw-r--r--spec/eet_spec.rb122
1 files changed, 66 insertions, 56 deletions
diff --git a/spec/eet_spec.rb b/spec/eet_spec.rb
index 429f548..0ba0c40 100644
--- a/spec/eet_spec.rb
+++ b/spec/eet_spec.rb
@@ -3,94 +3,104 @@
#
require 'e17/eet'
#
-describe E17::EET do
+describe E17::Eet do
#
include E17
#
FP = '/tmp/_eet.cfg'
#
it "should init" do
- EET.init.should eql 1
- EET.init.should eql 2
- EET.init.should eql 3
+ 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
+ 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
+ Eet.clearcache
+ Eet.clearcache
+ Eet.clearcache
+ end
+ #
+ it "should have good enums" do
+ Eet.enum_type(:eet_file_mode)[:invalid].should eql -1
+ Eet.enum_type(:eet_file_mode)[:read].should eql 0
+ Eet.enum_type(:eet_file_mode)[:write].should eql 1
+ Eet.enum_type(:eet_file_mode)[:read_write].should eql 2
end
#
it "should open and close" do
- EET.init
- f = EET.open FP, EET::FILE_MODE_WRITE
+ Eet.init
+ f = Eet.open FP, Eet.enum_type(:eet_file_mode)[:write]
f.write 'fake', 'value'
f.close
- EET.shutdown
+ Eet.shutdown
end
it "should be able to get file access mode" do
- EET.init
- [ EET::FILE_MODE_READ, EET::FILE_MODE_WRITE, EET::FILE_MODE_READ_WRITE ].each do |m|
- EET.open FP, m do |f|
+ Eet.init
+ Eet.enum_type(:eet_file_mode).symbols.each do |m|
+ next if m==:invalid
+ Eet.open FP, Eet.enum_type(:eet_file_mode)[m] do |f|
f.mode_get.should eql m
end
end
- EET.shutdown
+ Eet.shutdown
end
#
it "should write" do
- EET.init
- f = EET.open FP, EET::FILE_MODE_WRITE
+ Eet.init
+ f = Eet.open FP, :write
+ f.mode_get.should eql :write
f.write 'config', 'test key'
f.close
- EET.shutdown
+ Eet.shutdown
end
#
it "should read" do
- EET.init
- f = EET.open FP, EET::FILE_MODE_READ
+ Eet.init
+ f = Eet.open FP, :read
+ f.mode_get.should eql :read
f.read('config').should eql 'test key'
f.close
- EET.shutdown
+ Eet.shutdown
end
#
- it "should read/write" do
- EET.init
- f = EET.open FP, EET::FILE_MODE_READ_WRITE
- f.write 'configg', 'test key'
- f.read('configg').should eql 'test key'
- f.close
- EET.shutdown
- end
- #
- it "should write in block" do
- EET.init
- EET.open FP, EET::FILE_MODE_WRITE do |f|
- f.write 'config2', 'test--key'
- end
- EET.shutdown
- end
- #
- it "should read in block" do
- EET.init
- EET.open FP, EET::FILE_MODE_READ do |f|
- f.read('config2').should eql 'test--key'
- end
- EET.shutdown
- end
- #
- it "should read/write in block" do
- EET.init
- EET.open FP, EET::FILE_MODE_READ_WRITE do |f|
- f.write 'config22', 'test--key'
- f.read('config22').should eql 'test--key'
- end
- EET.shutdown
- end
+# it "should read/write" do
+# Eet.init
+# f = Eet.open FP, :read_write
+# f.write 'configg', 'test key'
+# f.read('configg').should eql 'test key'
+# f.close
+# Eet.shutdown
+# end
+# #
+# it "should write in block" do
+# Eet.init
+# Eet.open FP, :write do |f|
+# f.write 'config2', 'test--key'
+# end
+# Eet.shutdown
+# end
+# #
+# it "should read in block" do
+# Eet.init
+# Eet.open FP, :read do |f|
+# f.read('config2').should eql 'test--key'
+# end
+# Eet.shutdown
+# end
+# #
+# it "should read/write in block" do
+# Eet.init
+# Eet.open FP, :read_write do |f|
+# f.write 'config22', 'test--key'
+# f.read('config22').should eql 'test--key'
+# end
+# Eet.shutdown
+# end
end