PageRenderTime 9ms CodeModel.GetById 1ms app.highlight 3ms RepoModel.GetById 1ms app.codeStats 0ms

/test/language/exceptions/test_exceptions07.e

http://github.com/tybor/Liberty
Specman e | 71 lines | 43 code | 7 blank | 21 comment | 3 complexity | f86c3da6e2f45e19f5a8412724f3672a MD5 | raw file
 1-- This file is part of SmartEiffel The GNU Eiffel Compiler Tools and Libraries.
 2-- See the Copyright notice at the end of this file.
 3--
 4class TEST_EXCEPTIONS07
 5
 6insert
 7   EXCEPTIONS
 8
 9create {}
10   make
11
12feature {ANY}
13   make
14      local
15         counter: INTEGER
16      do
17         if counter = 0 then
18            make2
19         end
20      rescue
21         counter := counter + 1
22         is_true(cpt = 1)
23         retry
24      end
25
26   make2
27      local
28         aux: AUX_EXCEPTIONS07
29      do
30         if aux = Void then
31            create aux
32            aux.do_invariant_violation
33         end
34      rescue
35         is_true(Class_invariant = exception)
36         aux.restore_invariant
37         retry
38      end
39
40feature {}
41   is_true (b: BOOLEAN)
42      do
43         cpt := cpt + 1
44         if not b then
45            std_output.put_string("TEST_EXCEPTION07: ERROR Test # ")
46            std_output.put_integer(cpt)
47            std_output.put_string("%N")
48         end
49      end
50
51   cpt: INTEGER
52
53end -- class TEST_EXCEPTIONS07
54--
55-- ------------------------------------------------------------------------------------------------------------------------------
56-- Copyright notice below. Please read.
57--
58-- SmartEiffel is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License,
59-- as published by the Free Software Foundation; either version 2, or (at your option) any later version.
60-- SmartEiffel is distributed in the hope that it will be useful but WITHOUT ANY WARRANTY; without even the implied warranty
61-- of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have
62-- received a copy of the GNU General Public License along with SmartEiffel; see the file COPYING. If not, write to the Free
63-- Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
64--
65-- Copyright(C) 1994-2002: INRIA - LORIA (INRIA Lorraine) - ESIAL U.H.P.       - University of Nancy 1 - FRANCE
66-- Copyright(C) 2003-2006: INRIA - LORIA (INRIA Lorraine) - I.U.T. Charlemagne - University of Nancy 2 - FRANCE
67--
68-- Authors: Dominique COLNET, Philippe RIBET, Cyril ADRIAN, Vincent CROIZIER, Frederic MERIZEN
69--
70-- http://SmartEiffel.loria.fr - SmartEiffel@loria.fr
71-- ------------------------------------------------------------------------------------------------------------------------------