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