/test/language/exceptions/test_exceptions03.e

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