From 8e9d5ca59eaef7e977857ebe39c086c966c556dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Zurcher?= Date: Thu, 18 Aug 2011 10:22:55 +0200 Subject: cleanup init/shutdown specs --- spec/ecore_evas_spec.rb | 4 ++-- spec/ecore_getopt_spec.rb | 8 ++++---- spec/ecore_input_spec.rb | 16 ++++++++++------ spec/ecore_spec.rb | 20 ++++++++++---------- spec/edje_spec.rb | 24 +++++++++++++----------- spec/eet_spec.rb | 22 ++++++++++++---------- spec/eina_hash_spec.rb | 12 ++++++------ spec/eina_list_spec.rb | 12 ++++++------ spec/eina_log_spec.rb | 8 ++++---- spec/eina_spec.rb | 22 +++++++++++----------- spec/elm_spec.rb | 23 +++++++++++++++++------ spec/evas_spec.rb | 20 +++++++++++--------- 12 files changed, 106 insertions(+), 85 deletions(-) diff --git a/spec/ecore_evas_spec.rb b/spec/ecore_evas_spec.rb index 94cde21..281b357 100644 --- a/spec/ecore_evas_spec.rb +++ b/spec/ecore_evas_spec.rb @@ -48,9 +48,9 @@ describe Efl::EcoreEvas do end # describe Efl::EcoreEvas::REcoreEvas do - before(:all) { + before(:all) do EcoreEvas.init.should == 2 - } + end before(:each) do @e = EcoreEvas::REcoreEvas.new :engine_name=>"software_x11", :x=>10, :y=>10, :w=>100, :h=>120 @canvas = @e.evas diff --git a/spec/ecore_getopt_spec.rb b/spec/ecore_getopt_spec.rb index 7dff80d..8c2a565 100644 --- a/spec/ecore_getopt_spec.rb +++ b/spec/ecore_getopt_spec.rb @@ -9,12 +9,12 @@ require 'efl/ecore_getopt' # describe Efl::EcoreGetopt do # - after(:all) { + after(:all) do Efl::Ecore.shutdown - } - before(:all) { + end + before(:all) do Efl::Ecore.init - } + end # before(:each) do # diff --git a/spec/ecore_input_spec.rb b/spec/ecore_input_spec.rb index 51f23a8..29698e9 100644 --- a/spec/ecore_input_spec.rb +++ b/spec/ecore_input_spec.rb @@ -7,18 +7,22 @@ describe Efl::EcoreInput do # before(:all) do EcoreInput = Efl::EcoreInput + @init = EcoreInput.init + end + after(:all) do + EcoreInput.shutdown end # it "should init" do - EcoreInput.init.should == 1 - EcoreInput.init.should == 2 - EcoreInput.init.should == 3 + EcoreInput.init.should == @init+1 + EcoreInput.init.should == @init+2 + EcoreInput.init.should == @init+3 end # it "should shutdown" do - EcoreInput.shutdown.should == 2 - EcoreInput.shutdown.should == 1 - EcoreInput.shutdown.should == 0 + EcoreInput.shutdown.should == @init+2 + EcoreInput.shutdown.should == @init+1 + EcoreInput.shutdown.should == @init end # end diff --git a/spec/ecore_spec.rb b/spec/ecore_spec.rb index 0632387..66f9d4c 100644 --- a/spec/ecore_spec.rb +++ b/spec/ecore_spec.rb @@ -22,22 +22,22 @@ describe "Efl::Ecore #{Efl::Ecore.version.full}" do OK = FFI::MemoryPointer.from_string "ok" KO = FFI::MemoryPointer.from_string "ko" NONE = FFI::MemoryPointer.from_string "none" + @init = Ecore.init + end + after(:all) do + Ecore.shutdown end - before(:each) { - Ecore.init==1 - } - after(:each) { - Ecore.shutdown==0 - } # it "should init" do - Ecore.init.should == 2 - Ecore.init.should == 3 + Ecore.init.should == @init+1 + Ecore.init.should == @init+2 + Ecore.init.should == @init+3 end # it "should shutdown" do - Ecore.shutdown.should == 2 - Ecore.shutdown.should == 1 + Ecore.shutdown.should == @init+2 + Ecore.shutdown.should == @init+1 + Ecore.shutdown.should == @init end # it "should run a single iteration of the mainloop" do diff --git a/spec/edje_spec.rb b/spec/edje_spec.rb index a1e851e..aa6a6d3 100644 --- a/spec/edje_spec.rb +++ b/spec/edje_spec.rb @@ -23,22 +23,24 @@ require './spec/helper' # describe "Efl::Edje #{Efl::Edje.version.full}" do # - before(:all) { + before(:all) do Edje = Efl::Edje - Edje.init.should == 1 - } - after(:all) { - Edje.shutdown == 0 - } + @init = Edje.init + end + after(:all) do + Edje.shutdown + end # it "should init" do - Edje.init.should == 2 - Edje.init.should == 3 + Edje.init.should == @init+1 + Edje.init.should == @init+2 + Edje.init.should == @init+3 end # it "should shutdown" do - Edje.shutdown.should == 2 - Edje.shutdown.should == 1 + Edje.shutdown.should == @init+2 + Edje.shutdown.should == @init+1 + Edje.shutdown.should == @init end # it "frametime get/set " do @@ -105,7 +107,7 @@ describe "Efl::Edje #{Efl::Edje.version.full}" do after(:all) do @e.free @pixels.free - Efl::Evas.shutdown.should==0 + Efl::Evas.shutdown end # it "scale get/set " do diff --git a/spec/eet_spec.rb b/spec/eet_spec.rb index f332c9b..c12cbb9 100644 --- a/spec/eet_spec.rb +++ b/spec/eet_spec.rb @@ -5,24 +5,28 @@ require 'efl/eet' # describe "Efl::Eet #{Efl::Eet.version.full}" do # - before(:all) { + before(:all) do Eet = Efl::Eet Native = Efl::Native unless Kernel.const_defined? 'Native' REetFile = Efl::Eet::REetFile - } + @init = Eet.init + end + after(:all) do + Eet.shutdown + end # FP = '/tmp/_eet.cfg' # it "should init" do - Eet.init.should == 1 - Eet.init.should == 2 - Eet.init.should == 3 + Eet.init.should == @init+1 + Eet.init.should == @init+2 + Eet.init.should == @init+3 end # it "should shutdown" do - Eet.shutdown.should == 2 - Eet.shutdown.should == 1 - Eet.shutdown.should == 0 + Eet.shutdown.should == @init+2 + Eet.shutdown.should == @init+1 + Eet.shutdown.should == @init end # it "should clearcache" do @@ -39,8 +43,6 @@ describe "Efl::Eet #{Efl::Eet.version.full}" do end # describe Efl::Eet::REetFile do - before(:all) { Eet.init.should==1 } - after(:all) { Eet.shutdown.should==0 } # it "should open and close" do f = REetFile.open FP, Native.enum_type(:eet_file_mode)[:eet_file_mode_write] diff --git a/spec/eina_hash_spec.rb b/spec/eina_hash_spec.rb index 48347a4..d9c6ce0 100644 --- a/spec/eina_hash_spec.rb +++ b/spec/eina_hash_spec.rb @@ -6,17 +6,17 @@ require 'efl/eina_hash' # describe Efl::EinaHash do # - before(:all) { + before(:all) do REinaHash = Efl::EinaHash::REinaHash - Efl::Eina.init.should == 1 + Efl::Eina.init @d0 = FFI::MemoryPointer.from_string "D0" @d1 = FFI::MemoryPointer.from_string "D1" @d2 = FFI::MemoryPointer.from_string "D2" @d3 = FFI::MemoryPointer.from_string "D3" - } - after(:all) { - Efl::Eina.shutdown.should == 0 - } + end + after(:all) do + Efl::Eina.shutdown + end # it "should append prepend and fetch" do h = REinaHash.new diff --git a/spec/eina_list_spec.rb b/spec/eina_list_spec.rb index 230e9bb..0d486b4 100644 --- a/spec/eina_list_spec.rb +++ b/spec/eina_list_spec.rb @@ -6,13 +6,13 @@ require 'efl/eina_list' # describe Efl::EinaList do # - before(:all) { + before(:all) do REinaList = Efl::EinaList::REinaList - Efl::Eina.init.should == 1 - } - after(:all) { - Efl::Eina.shutdown.should == 0 - } + Efl::Eina.init + end + after(:all) do + Efl::Eina.shutdown + end # it "should append prepend and fetch" do l = REinaList.new diff --git a/spec/eina_log_spec.rb b/spec/eina_log_spec.rb index 0f606b0..aea4ed4 100644 --- a/spec/eina_log_spec.rb +++ b/spec/eina_log_spec.rb @@ -6,13 +6,13 @@ require 'efl/eina_log' require './spec/helper' # describe Efl::EinaLog do - before(:all) { + before(:all) do Efl::Eina.init EinaLog = Efl::EinaLog - } - after(:all) { + end + after(:all) do Efl::Eina.shutdown - } + end # it "level set/get" do EinaLog.level_set 2 diff --git a/spec/eina_spec.rb b/spec/eina_spec.rb index 9e1d8b6..65fe713 100644 --- a/spec/eina_spec.rb +++ b/spec/eina_spec.rb @@ -4,17 +4,17 @@ require 'efl/eina' # describe "Efl::Eina #{Efl::Eina.version.full}" do - before(:all) { - @i = Efl::Eina.init - } - after(:all) { + before(:all) do + @init = Efl::Eina.init + end + after(:all) do Efl::Eina.shutdown - } + end # it "should init" do - Efl::Eina.init.should == @i+1 - Efl::Eina.init.should == @i+2 - Efl::Eina.init.should == @i+3 + Efl::Eina.init.should == @init+1 + Efl::Eina.init.should == @init+2 + Efl::Eina.init.should == @init+3 end # it "should be main thread" do @@ -29,9 +29,9 @@ describe "Efl::Eina #{Efl::Eina.version.full}" do end # it "should shutdown" do - Efl::Eina.shutdown.should == @i+2 - Efl::Eina.shutdown.should == @i+1 - Efl::Eina.shutdown.should == @i+0 + Efl::Eina.shutdown.should == @init+2 + Efl::Eina.shutdown.should == @init+1 + Efl::Eina.shutdown.should == @init end # end diff --git a/spec/elm_spec.rb b/spec/elm_spec.rb index 3073e9b..ff23459 100644 --- a/spec/elm_spec.rb +++ b/spec/elm_spec.rb @@ -6,13 +6,24 @@ require './spec/helper' # describe "Efl::Elm #{Efl::Elm.version.full}" do # - before(:all) { + before(:all) do Elm = Efl::Elm - Elm.init.should == 1 - } - after(:all) { - Elm.shutdown.should == 0 - } + @init = Elm.init + end + after(:all) do + Elm.shutdown + end + it "should init" do + Elm.init.should == @init+1 + Elm.init.should == @init+2 + Elm.init.should == @init+3 + end + # + it "should shutdown" do + Elm.shutdown.should == @init+2 + Elm.shutdown.should == @init+1 + Elm.shutdown.should == @init + end # describe Efl::Elm::ElmWin do before(:each) { diff --git a/spec/evas_spec.rb b/spec/evas_spec.rb index be19c59..ac59294 100644 --- a/spec/evas_spec.rb +++ b/spec/evas_spec.rb @@ -8,23 +8,25 @@ require './spec/helper' # describe "Efl::Evas #{Efl::Evas.version.full}" do # - before(:all) { + before(:all) do Evas = Efl::Evas Native = Efl::Native unless Kernel.const_defined? 'Native' - Evas.init.should == 1 - } - after(:all) { + @init = Evas.init + end + after(:all) do Evas.shutdown.should == 0 - } + end # it "should init" do - Evas.init.should == 2 - Evas.init.should == 3 + Evas.init.should == @init+1 + Evas.init.should == @init+2 + Evas.init.should == @init+3 end # it "should shutdown" do - Evas.shutdown.should == 2 - Evas.shutdown.should == 1 + Evas.shutdown.should == @init+2 + Evas.shutdown.should == @init+1 + Evas.shutdown.should == @init end # it "evas alloc error enum is ok" do -- cgit v1.1-2-g2b99