/test/language/agent/test_agent54.e

http://github.com/tybor/Liberty · Specman e · 68 lines · 33 code · 10 blank · 25 comment · 0 complexity · 1713bd3e387b0fa2b8f4b58e1c02cc69 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_AGENT54
  5. --
  6. -- From a bug report of Wolfgang Jansen on our mailing list.
  7. -- SZ:490:
  8. --
  9. insert
  10. EIFFELTEST_TOOLS
  11. create {}
  12. make
  13. feature {}
  14. make
  15. local
  16. v: INTEGER
  17. do
  18. n := 3
  19. func := agent func_run(n) -- closed_arg=3 at agent creation time
  20. n := 5
  21. v := func.item([]) -- uses new value of `n' for closed_arg
  22. assert(v = 3)
  23. n := 3
  24. proc := agent proc_run(n)
  25. n := 5
  26. proc.call([])
  27. assert(n = 3)
  28. end
  29. n: INTEGER
  30. func: FUNCTION[TUPLE, INTEGER]
  31. func_run (i: INTEGER): INTEGER
  32. do
  33. Result := i
  34. end
  35. proc: PROCEDURE[TUPLE]
  36. proc_run (i: INTEGER)
  37. do
  38. n := i
  39. end
  40. end -- TEST_AGENT54
  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. -- ------------------------------------------------------------------------------------------------------------------------------