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