PageRenderTime 5ms CodeModel.GetById 1ms app.highlight 1ms RepoModel.GetById 2ms app.codeStats 0ms

/test/language/agent/test_agent26.e

http://github.com/tybor/Liberty
Specman e | 82 lines | 48 code | 11 blank | 23 comment | 1 complexity | cc3c1cc8ff8cdc4dec1c1c08829932bc 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_AGENT26
 5   -- Bug from SZ:211: error in boost mode
 6
 7insert
 8   EIFFELTEST_TOOLS
 9
10create {}
11   make
12
13feature {ANY}
14   last_call: INTEGER
15
16   msg: STRING
17
18   no_arg
19      do
20         last_call := 1
21      end
22
23   str_arg (s: STRING)
24      do
25         last_call := 2
26         msg := s
27      end
28
29   action: PROCEDURE[TUPLE[STRING]]
30
31   set_action (a: like action)
32      do
33         action := a
34      end
35
36   perform
37      local
38         a_no_arg: PROCEDURE[TUPLE]
39      do
40         a_no_arg ?= action
41         if a_no_arg /= Void then
42            a_no_arg.call([])
43         else
44            action.call(["test"])
45         end
46      end
47
48   make
49         -- Bug: `no_arg' is not called in boost mode
50      do
51         set_action(agent str_arg(?))
52         perform -- if this line is left out it works again
53         assert(last_call = 2)
54         last_call := 0
55         assert(msg.is_equal("test"))
56         msg := Void
57         set_action(agent no_arg)
58         perform
59         assert(last_call = 1)
60         last_call := 0
61         assert(msg = Void)
62      end
63
64end -- class TEST_AGENT26
65--
66-- ------------------------------------------------------------------------------------------------------------------------------
67-- Copyright notice below. Please read.
68--
69-- SmartEiffel is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License,
70-- as published by the Free Software Foundation; either version 2, or (at your option) any later version.
71-- SmartEiffel is distributed in the hope that it will be useful but WITHOUT ANY WARRANTY; without even the implied warranty
72-- of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have
73-- received a copy of the GNU General Public License along with SmartEiffel; see the file COPYING. If not, write to the Free
74-- Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
75--
76-- Copyright(C) 1994-2002: INRIA - LORIA (INRIA Lorraine) - ESIAL U.H.P.       - University of Nancy 1 - FRANCE
77-- Copyright(C) 2003-2006: INRIA - LORIA (INRIA Lorraine) - I.U.T. Charlemagne - University of Nancy 2 - FRANCE
78--
79-- Authors: Dominique COLNET, Philippe RIBET, Cyril ADRIAN, Vincent CROIZIER, Frederic MERIZEN
80--
81-- http://SmartEiffel.loria.fr - SmartEiffel@loria.fr
82-- ------------------------------------------------------------------------------------------------------------------------------