PageRenderTime 9ms CodeModel.GetById 1ms app.highlight 3ms RepoModel.GetById 1ms app.codeStats 0ms

/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--
 4class TEST_AGENT54
 5--
 6-- From a bug report of Wolfgang Jansen on our mailing list.
 7-- SZ:490:
 8--
 9
10insert
11   EIFFELTEST_TOOLS
12
13create {}
14   make
15
16feature {}
17   make
18      local
19         v: INTEGER
20      do
21         n := 3
22         func := agent func_run(n) -- closed_arg=3 at agent creation time
23         n := 5
24         v := func.item([])  -- uses new value of `n' for closed_arg
25         assert(v = 3)
26
27         n := 3
28         proc := agent proc_run(n)
29         n := 5
30         proc.call([])
31         assert(n = 3)
32      end
33
34   n: INTEGER
35
36   func: FUNCTION[TUPLE, INTEGER]
37
38   func_run (i: INTEGER): INTEGER
39      do
40         Result := i
41      end
42
43   proc: PROCEDURE[TUPLE]
44
45   proc_run (i: INTEGER)
46      do
47         n := i
48      end
49
50end -- TEST_AGENT54
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-- ------------------------------------------------------------------------------------------------------------------------------