/test/language/exceptions/test_exceptions09.e

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