/test/language/exceptions/test_exceptions18.e

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