PageRenderTime 30ms CodeModel.GetById 23ms app.highlight 2ms RepoModel.GetById 1ms app.codeStats 1ms

/test/language/exceptions/test_exceptions17.e

http://github.com/tybor/Liberty
Specman e | 101 lines | 65 code | 14 blank | 22 comment | 1 complexity | 951699b155706dce8dc6c43a538fa2c7 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_EXCEPTIONS17
  5
  6insert
  7   EXCEPTIONS
  8
  9create {}
 10   make
 11
 12feature {ANY}
 13   i: INTEGER
 14
 15   make
 16      do
 17         make2
 18         inspect
 19            require_count
 20         when 0, 1 then
 21            is_true(body_count = 1)
 22            is_true(ensure_count = 0)
 23            is_true(rescue_count = 0)
 24         when 2 then
 25            is_true(body_count = 2)
 26            is_true(ensure_count = 2)
 27            is_true(rescue_count = 1)
 28         else
 29            is_true(False)
 30         end
 31      end
 32
 33   make2
 34      require
 35         increment_require_count
 36      do
 37         body_count := body_count + 1
 38      ensure
 39         increment_ensure_count
 40         i /= 0
 41      rescue
 42         rescue_count := rescue_count + 1
 43         i := 1
 44         retry
 45      end
 46
 47   body_count: INTEGER
 48
 49   rescue_count: INTEGER
 50
 51   increment_require_count: BOOLEAN
 52      do
 53         require_count := require_count + 1
 54         Result := True
 55      end
 56
 57   require_count: INTEGER
 58
 59   increment_ensure_count: BOOLEAN
 60      do
 61         ensure_count := ensure_count + 1
 62         Result := True
 63      end
 64
 65   ensure_count: INTEGER
 66
 67feature {ANY}
 68   is_true (b: BOOLEAN)
 69      do
 70         cpt := cpt + 1
 71         if not b then
 72            crash
 73            std_output.put_string("TEST_EXCEPTION17: ERROR Test # ")
 74            std_output.put_integer(cpt)
 75            std_output.put_string("%N")
 76         else
 77            --std_output.put_string("Yes%N");
 78         end
 79      end
 80
 81   cpt: INTEGER
 82
 83end -- class TEST_EXCEPTIONS17
 84--
 85-- ------------------------------------------------------------------------------------------------------------------------------
 86-- Copyright notice below. Please read.
 87--
 88-- SmartEiffel is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License,
 89-- as published by the Free Software Foundation; either version 2, or (at your option) any later version.
 90-- SmartEiffel is distributed in the hope that it will be useful but WITHOUT ANY WARRANTY; without even the implied warranty
 91-- of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have
 92-- received a copy of the GNU General Public License along with SmartEiffel; see the file COPYING. If not, write to the Free
 93-- Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
 94--
 95-- Copyright(C) 1994-2002: INRIA - LORIA (INRIA Lorraine) - ESIAL U.H.P.       - University of Nancy 1 - FRANCE
 96-- Copyright(C) 2003-2006: INRIA - LORIA (INRIA Lorraine) - I.U.T. Charlemagne - University of Nancy 2 - FRANCE
 97--
 98-- Authors: Dominique COLNET, Philippe RIBET, Cyril ADRIAN, Vincent CROIZIER, Frederic MERIZEN
 99--
100-- http://SmartEiffel.loria.fr - SmartEiffel@loria.fr
101-- ------------------------------------------------------------------------------------------------------------------------------