1;;
2;; %CopyrightBegin%
3;;
4;; Copyright Ericsson AB 2010-2016. All Rights Reserved.
5;;
6;; Licensed under the Apache License, Version 2.0 (the "License");
7;; you may not use this file except in compliance with the License.
8;; You may obtain a copy of the License at
9;;
10;;     http://www.apache.org/licenses/LICENSE-2.0
11;;
12;; Unless required by applicable law or agreed to in writing, software
13;; distributed under the License is distributed on an "AS IS" BASIS,
14;; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15;; See the License for the specific language governing permissions and
16;; limitations under the License.
17;;
18;; %CopyrightEnd%
19;;;
20;;; Purpose: Provide Erlang code skeletons.
21;;; See 'erlang-skel-file' variable.
22
23(defvar erlang-tempo-tags nil
24  "Tempo tags for erlang mode")
25
26(defvar erlang-skel
27  '(("If"            "if"            erlang-skel-if)
28    ("Case"          "case"          erlang-skel-case)
29    ("Receive"       "receive"       erlang-skel-receive)
30    ("Receive After" "after"         erlang-skel-receive-after)
31    ("Receive Loop"  "loop"          erlang-skel-receive-loop)
32    ("Module"        "module"        erlang-skel-module)
33    ("Author"        "author"        erlang-skel-author)
34    ()
35    ("Small Header"  "small-header"
36     erlang-skel-small-header erlang-skel-header)
37    ("Normal Header" "normal-header"
38     erlang-skel-normal-header erlang-skel-header)
39    ("Large Header"  "large-header"
40     erlang-skel-large-header erlang-skel-header)
41    ()
42    ("Small Server"   "small-server"
43     erlang-skel-small-server erlang-skel-header)
44    ()
45    ("Application" "application"
46     erlang-skel-application erlang-skel-header)
47    ("Supervisor" "supervisor"
48     erlang-skel-supervisor erlang-skel-header)
49    ("supervisor_bridge" "supervisor-bridge"
50     erlang-skel-supervisor-bridge erlang-skel-header)
51    ("gen_server" "generic-server"
52     erlang-skel-generic-server erlang-skel-header)
53    ("gen_event" "gen-event"
54     erlang-skel-gen-event erlang-skel-header)
55    ("gen_fsm" "gen-fsm"
56     erlang-skel-gen-fsm erlang-skel-header)
57    ("Library module" "gen-lib"
58     erlang-skel-lib erlang-skel-header)
59    ("Corba callback" "gen-corba-cb"
60     erlang-skel-corba-callback erlang-skel-header)
61    ("Small Common Test suite" "ct-test-suite-s"
62     erlang-skel-ct-test-suite-s erlang-skel-header)
63    ("Large Common Test suite" "ct-test-suite-l"
64     erlang-skel-ct-test-suite-l erlang-skel-header)
65    ("Erlang TS test suite" "ts-test-suite"
66     erlang-skel-ts-test-suite erlang-skel-header)
67  )
68  "*Description of all skeleton templates.
69Both functions and menu entries will be created.
70
71Each entry in `erlang-skel' should be a list with three or four
72elements, or the empty list.
73
74The first element is the name which shows up in the menu.  The second
75is the `tempo' identifier (The string \"erlang-\" will be added in
76front of it).  The third is the skeleton descriptor, a variable
77containing `tempo' attributes as described in the function
78`tempo-define-template'.  The optional fourth elements denotes a
79function which should be called when the menu is selected.
80
81Functions corresponding to every template will be created.  The name
82of the function will be `tempo-template-erlang-X' where `X' is the
83tempo identifier as specified in the second argument of the elements
84in this list.
85
86A list with zero elements means that the a horizontal line should
87be placed in the menu.")
88
89;; In XEmacs `user-mail-address' returns "x@y.z (Foo Bar)" ARGH!
90;; What's wrong with that? RFC 822 says it's legal.   [sverkerw]
91;; This needs to use the customized value.  If that's not sane, things like
92;; add-log will lose anyhow.  Avoid it if there _is_ a paren.
93(defvar erlang-skel-mail-address
94  (if (or (not user-mail-address) (string-match "(" user-mail-address))
95      (concat (user-login-name) "@"
96	      (or (and (boundp 'mail-host-address)
97		       mail-host-address)
98		  (system-name)))
99    user-mail-address)
100  "Mail address of the user.")
101
102;; Expression templates:
103(defvar erlang-skel-case
104  '((erlang-skel-skip-blank) o >
105    "case " p " of" n> p "_ ->" n> p "ok" n> "end" p)
106  "*The skeleton of a `case' expression.
107Please see the function `tempo-define-template'.")
108
109(defvar erlang-skel-if
110  '((erlang-skel-skip-blank) o >
111    "if"  n> p " ->" n> p "ok" n> "end" p)
112  "The skeleton of an `if' expression.
113Please see the function `tempo-define-template'.")
114
115(defvar erlang-skel-receive
116  '((erlang-skel-skip-blank) o >
117    "receive" n> p "_ ->" n> p "ok" n> "end" p)
118  "*The skeleton of a `receive' expression.
119Please see the function `tempo-define-template'.")
120
121(defvar erlang-skel-receive-after
122  '((erlang-skel-skip-blank) o >
123    "receive" n> p "_ ->" n> p "ok" n> "after " p "T ->" n>
124    p "ok" n> "end" p)
125  "*The skeleton of a `receive' expression with an `after' clause.
126Please see the function `tempo-define-template'.")
127
128(defvar erlang-skel-receive-loop
129  '(& o "loop(" p ") ->" n> "receive" n> p "_ ->" n>
130      "loop(" p ")" n> "end.")
131  "*The skeleton of a simple `receive' loop.
132Please see the function `tempo-define-template'.")
133
134
135;; Attribute templates
136
137(defvar erlang-skel-module
138  '(& "-module("
139      (erlang-add-quotes-if-needed (erlang-get-module-from-file-name))
140      ")." n)
141  "*The skeleton of a `module' attribute.
142Please see the function `tempo-define-template'.")
143
144(defvar erlang-skel-author
145  '(& "-author('" erlang-skel-mail-address "')." n)
146  "*The skeleton of a `author' attribute.
147Please see the function `tempo-define-template'.")
148
149(defvar erlang-skel-vc nil
150  "*The skeleton template to generate a version control attribute.
151The default is to insert nothing.  Example of usage:
152
153    (setq erlang-skel-vc '(& \"-rcs(\\\"$\Id: $ \\\").\") n)
154
155Please see the function `tempo-define-template'.")
156
157(defvar erlang-skel-export
158  '(& "-export([" n> "])." n)
159  "*The skeleton of an `export' attribute.
160Please see the function `tempo-define-template'.")
161
162(defvar erlang-skel-import
163  '(& "%%-import(Module, [Function/Arity, ...])." n)
164  "*The skeleton of an `import' attribute.
165Please see the function `tempo-define-template'.")
166
167(defvar erlang-skel-compile nil
168  ;;  '(& "%%-compile(export_all)." n)
169  "*The skeleton of a `compile' attribute.
170Please see the function `tempo-define-template'.")
171
172
173;; Comment templates.
174
175(defvar erlang-skel-date-function 'erlang-skel-dd-mmm-yyyy
176  "*Function which returns date string.
177Look in the module `time-stamp' for a battery of functions.")
178
179(defvar erlang-skel-copyright-comment '()
180  "*The template for a copyright line in the header, normally empty.
181This variable should be bound to a `tempo' template, for example:
182  '(& \"%%% Copyright (C) 2000, Yoyodyne, Inc.\" n)
183
184Please see the function `tempo-define-template'.")
185
186(defvar erlang-skel-created-comment
187  '(& "%%% Created : " (funcall erlang-skel-date-function) " by "
188      (user-full-name) " <" erlang-skel-mail-address ">" n)
189  "*The template for the \"Created:\" comment line.")
190
191(defvar erlang-skel-author-comment
192  '(& "%%% Author  : " (user-full-name) " <" erlang-skel-mail-address ">" n)
193  "*The template for creating the \"Author:\" line in the header.
194Please see the function `tempo-define-template'.")
195
196(defvar erlang-skel-file-comment
197  '(& "%%% File    : " (file-name-nondirectory buffer-file-name) n)
198"*The template for creating the \"Module:\" line in the header.
199Please see the function `tempo-define-template'.")
200
201(defvar erlang-skel-small-header
202  '(o (erlang-skel-include erlang-skel-module)
203      ;;                           erlang-skel-author)
204      n
205      (erlang-skel-include erlang-skel-compile
206			   ;;			   erlang-skel-export
207			   erlang-skel-vc))
208  "*The template of a small header without any comments.
209Please see the function `tempo-define-template'.")
210
211(defvar erlang-skel-normal-header
212  '(o (erlang-skel-include erlang-skel-copyright-comment
213			   erlang-skel-file-comment
214			   erlang-skel-author-comment)
215      "%%% Description : " p n
216      (erlang-skel-include erlang-skel-created-comment) n
217      (erlang-skel-include erlang-skel-small-header) n)
218  "*The template of a normal header.
219Please see the function `tempo-define-template'.")
220
221(defvar erlang-skel-large-header
222  '(o (erlang-skel-separator)
223      (erlang-skel-include erlang-skel-copyright-comment
224			   erlang-skel-file-comment
225			   erlang-skel-author-comment)
226      "%%% Description : " p n
227      "%%%" n
228      (erlang-skel-include erlang-skel-created-comment)
229      (erlang-skel-separator)
230      (erlang-skel-include erlang-skel-small-header) )
231  "*The template of a large header.
232Please see the function `tempo-define-template'.")
233
234
235;; Server templates.
236
237(defvar erlang-skel-small-server
238  '((erlang-skel-include erlang-skel-large-header)
239    "-export([start/0,init/1])." n n n
240    "start() ->" n> "spawn(" (erlang-get-module-from-file-name)
241    ", init, [self()])." n n
242    "init(From) ->" n>
243    "loop(From)." n n
244    "loop(From) ->" n>
245    "receive" n>
246    p "_ ->" n>
247    "loop(From)" n>
248    "end."
249    )
250  "*Template of a small server.
251Please see the function `tempo-define-template'.")
252
253;; Behaviour templates.
254
255(defvar erlang-skel-application
256  '((erlang-skel-include erlang-skel-large-header)
257    "-behaviour(application)." n n
258    "%% Application callbacks" n
259    "-export([start/2, stop/1])." n n
260    (erlang-skel-double-separator 2)
261    "%% Application callbacks" n
262    (erlang-skel-double-separator 2)
263    (erlang-skel-separator 2)
264    "%% Function: start(Type, StartArgs) -> {ok, Pid} |" n
265    "%%                                     {ok, Pid, State} |" n
266    "%%                                     {error, Reason}" n
267    "%% Description: This function is called whenever an application " n
268    "%% is started using application:start/1,2, and should start the processes" n
269    "%% of the application. If the application is structured according to the" n
270    "%% OTP design principles as a supervision tree, this means starting the" n
271    "%% top supervisor of the tree." n
272    (erlang-skel-separator 2)
273    "start(_Type, StartArgs) ->" n>
274    "case 'TopSupervisor':start_link(StartArgs) of" n>
275    "{ok, Pid} -> " n>
276    "{ok, Pid};" n>
277    "Error ->" n>
278    "Error" n>
279    "end." n
280    n
281    (erlang-skel-separator 2)
282    "%% Function: stop(State) -> void()" n
283    "%% Description: This function is called whenever an application" n
284    "%% has stopped. It is intended to be the opposite of Module:start/2 and" n
285    "%% should do any necessary cleaning up. The return value is ignored. "n
286    (erlang-skel-separator 2)
287    "stop(_State) ->" n>
288    "ok." n
289    n
290    (erlang-skel-double-separator 2)
291    "%% Internal functions" n
292    (erlang-skel-double-separator 2)
293    )
294  "*The template of an application behaviour.
295Please see the function `tempo-define-template'.")
296
297(defvar erlang-skel-supervisor
298  '((erlang-skel-include erlang-skel-large-header)
299    "-behaviour(supervisor)." n n
300
301    "%% API" n
302    "-export([start_link/0])." n n
303
304    "%% Supervisor callbacks" n
305    "-export([init/1])." n n
306
307    "-define(SERVER, ?MODULE)." n n
308
309    (erlang-skel-double-separator 2)
310    "%% API functions" n
311    (erlang-skel-double-separator 2)
312    (erlang-skel-separator 2)
313    "%% Function: start_link() -> {ok,Pid} | ignore | {error,Error}" n
314    "%% Description: Starts the supervisor" n
315    (erlang-skel-separator 2)
316    "start_link() ->" n>
317    "supervisor:start_link({local, ?SERVER}, ?MODULE, [])." n
318    n
319    (erlang-skel-double-separator 2)
320    "%% Supervisor callbacks" n
321    (erlang-skel-double-separator 2)
322    (erlang-skel-separator 2)
323    "%% Func: init(Args) -> {ok,  {SupFlags,  [ChildSpec]}} |" n
324    "%%                     ignore                          |" n
325    "%%                     {error, Reason}" n
326    "%% Description: Whenever a supervisor is started using "n
327    "%% supervisor:start_link/[2,3], this function is called by the new process "n
328    "%% to find out about restart strategy, maximum restart frequency and child "n
329    "%% specifications." n
330    (erlang-skel-separator 2)
331    "init([]) ->" n>
332    "AChild = {'AName',{'AModule',start_link,[]}," n>
333    "permanent,2000,worker,['AModule']}," n>
334    "{ok,{{one_for_all,0,1}, [AChild]}}." n
335    n
336    (erlang-skel-double-separator 2)
337    "%% Internal functions" n
338    (erlang-skel-double-separator 2)
339    )
340  "*The template of an supervisor behaviour.
341Please see the function `tempo-define-template'.")
342
343(defvar erlang-skel-supervisor-bridge
344  '((erlang-skel-include erlang-skel-large-header)
345    "-behaviour(supervisor_bridge)." n n
346
347    "%% API" n
348    "-export([start_link/0])." n n
349
350    "%% supervisor_bridge callbacks" n
351    "-export([init/1, terminate/2])." n n
352
353    "-define(SERVER, ?MODULE)." n n
354
355    "-record(state, {})." n n
356
357    (erlang-skel-double-separator 2)
358    "%% API" n
359    (erlang-skel-double-separator 2)
360    (erlang-skel-separator 2)
361    "%% Function: start_link() -> {ok,Pid} | ignore | {error,Error}" n
362    "%% Description: Starts the supervisor bridge" n
363    (erlang-skel-separator 2)
364    "start_link() ->" n>
365    "supervisor_bridge:start_link({local, ?SERVER}, ?MODULE, [])." n
366    n
367    (erlang-skel-double-separator 2)
368    "%% supervisor_bridge callbacks" n
369    (erlang-skel-double-separator 2)
370    (erlang-skel-separator 2)
371    "%% Funcion: init(Args) -> {ok,  Pid, State} |" n
372    "%%                        ignore            |" n
373    "%%                        {error, Reason}    " n
374    "%% Description:Creates a supervisor_bridge process, linked to the calling" n
375    "%% process, which calls Module:init/1 to start the subsystem. To ensure a" n
376    "%% synchronized start-up procedure, this function does not return until" n
377    "%% Module:init/1 has returned. "  n
378    (erlang-skel-separator 2)
379    "init([]) ->" n>
380    "case 'AModule':start_link() of" n>
381    "{ok, Pid} ->" n>
382    "{ok, Pid, #state{}};" n>
383    "Error ->" n>
384    "Error" n>
385    "end." n
386    n
387    (erlang-skel-separator 2)
388    "%% Func: terminate(Reason, State) -> void()" n
389    "%% Description:This function is called by the supervisor_bridge when it is"n
390    "%% about to terminate. It should be the opposite of Module:init/1 and stop"n
391    "%% the subsystem and do any necessary cleaning up.The return value is ignored."
392    (erlang-skel-separator 2)
393    "terminate(Reason, State) ->" n>
394    "'AModule':stop()," n>
395    "ok." n
396    n
397    (erlang-skel-double-separator 2)
398    "%% Internal functions" n
399    (erlang-skel-double-separator 2)
400    )
401  "*The template of an supervisor_bridge behaviour.
402Please see the function `tempo-define-template'.")
403
404(defvar erlang-skel-generic-server
405  '((erlang-skel-include erlang-skel-large-header)
406    "-behaviour(gen_server)." n n
407
408    "%% API" n
409    "-export([start_link/0])." n n
410
411    "%% gen_server callbacks" n
412    "-export([init/1, handle_call/3, handle_cast/2, "
413    "handle_info/2," n>
414    "terminate/2, code_change/3])." n n
415
416    "-record(state, {})." n n
417
418    (erlang-skel-double-separator 2)
419    "%% API" n
420    (erlang-skel-double-separator 2)
421    (erlang-skel-separator 2)
422    "%% Function: start_link() -> {ok,Pid} | ignore | {error,Error}" n
423    "%% Description: Starts the server" n
424    (erlang-skel-separator 2)
425    "start_link() ->" n>
426    "gen_server:start_link({local, ?SERVER}, ?MODULE, [], [])." n
427    n
428    (erlang-skel-double-separator 2)
429    "%% gen_server callbacks" n
430    (erlang-skel-double-separator 2)
431    n
432    (erlang-skel-separator 2)
433    "%% Function: init(Args) -> {ok, State} |" n
434    "%%                         {ok, State, Timeout} |" n
435    "%%                         ignore               |" n
436    "%%                         {stop, Reason}" n
437    "%% Description: Initializes the server" n
438    (erlang-skel-separator 2)
439    "init([]) ->" n>
440    "{ok, #state{}}." n
441    n
442    (erlang-skel-separator 2)
443    "%% Function: "
444    "%% handle_call(Request, From, State) -> {reply, Reply, State} |" n
445    "%%                                      {reply, Reply, State, Timeout} |" n
446    "%%                                      {noreply, State} |" n
447    "%%                                      {noreply, State, Timeout} |" n
448    "%%                                      {stop, Reason, Reply, State} |" n
449    "%%                                      {stop, Reason, State}" n
450    "%% Description: Handling call messages" n
451    (erlang-skel-separator 2)
452    "handle_call(_Request, _From, State) ->" n>
453    "Reply = ok," n>
454    "{reply, Reply, State}." n
455    n
456    (erlang-skel-separator 2)
457    "%% Function: handle_cast(Msg, State) -> {noreply, State} |" n
458    "%%                                      {noreply, State, Timeout} |" n
459    "%%                                      {stop, Reason, State}" n
460    "%% Description: Handling cast messages" n
461
462    (erlang-skel-separator 2)
463    "handle_cast(_Msg, State) ->" n>
464    "{noreply, State}." n
465    n
466    (erlang-skel-separator 2)
467    "%% Function: handle_info(Info, State) -> {noreply, State} |" n
468    "%%                                       {noreply, State, Timeout} |" n
469    "%%                                       {stop, Reason, State}" n
470    "%% Description: Handling all non call/cast messages" n
471    (erlang-skel-separator 2)
472    "handle_info(_Info, State) ->" n>
473    "{noreply, State}." n
474    n
475    (erlang-skel-separator 2)
476    "%% Function: terminate(Reason, State) -> void()" n
477    "%% Description: This function is called by a gen_server when it is about to"n
478    "%% terminate. It should be the opposite of Module:init/1 and do any necessary"n
479    "%% cleaning up. When it returns, the gen_server terminates with Reason." n
480    "%% The return value is ignored." n
481
482    (erlang-skel-separator 2)
483    "terminate(_Reason, _State) ->" n>
484    "ok." n
485    n
486    (erlang-skel-separator 2)
487    "%% Func: code_change(OldVsn, State, Extra) -> {ok, NewState}" n
488    "%% Description: Convert process state when code is changed" n
489    (erlang-skel-separator 2)
490    "code_change(_OldVsn, State, _Extra) ->" n>
491    "{ok, State}." n
492    n
493    (erlang-skel-separator 2)
494    "%%% Internal functions" n
495    (erlang-skel-separator 2)
496    )
497  "*The template of a generic server.
498Please see the function `tempo-define-template'.")
499
500(defvar erlang-skel-gen-event
501  '((erlang-skel-include erlang-skel-large-header)
502    "-behaviour(gen_event)." n
503
504    "%% API" n
505    "-export([start_link/0, add_handler/0])." n n
506
507    "%% gen_event callbacks" n
508    "-export([init/1, handle_event/2, handle_call/2, " n>
509    "handle_info/2, terminate/2, code_change/3])." n n
510
511    "-record(state, {})." n n
512
513    (erlang-skel-double-separator 2)
514    "%% gen_event callbacks" n
515    (erlang-skel-double-separator 2)
516    (erlang-skel-separator 2)
517    "%% Function: start_link() -> {ok,Pid} | {error,Error} " n
518    "%% Description: Creates an event manager." n
519    (erlang-skel-separator 2)
520    "start_link() ->" n>
521    "gen_event:start_link({local, ?SERVER}). " n
522    n
523    (erlang-skel-separator 2)
524    "%% Function: add_handler() -> ok | {'EXIT',Reason} | term()" n
525    "%% Description: Adds an event handler" n
526    (erlang-skel-separator 2)
527    "add_handler() ->" n>
528    "gen_event:add_handler(?SERVER, ?MODULE, [])." n
529    n
530    (erlang-skel-double-separator 2)
531    "%% gen_event callbacks" n
532    (erlang-skel-double-separator 2)
533    (erlang-skel-separator 2)
534    "%% Function: init(Args) -> {ok, State}" n
535    "%% Description: Whenever a new event handler is added to an event manager,"n
536    "%% this function is called to initialize the event handler." n
537    (erlang-skel-separator 2)
538    "init([]) ->" n>
539    "{ok, #state{}}." n
540    n
541    (erlang-skel-separator 2)
542    "%% Function:  "n
543    "%% handle_event(Event, State) -> {ok, State} |" n
544    "%%                               {swap_handler, Args1, State1, Mod2, Args2} |"n
545    "%%                               remove_handler" n
546    "%% Description:Whenever an event manager receives an event sent using"n
547    "%% gen_event:notify/2 or gen_event:sync_notify/2, this function is called for"n
548    "%% each installed event handler to handle the event. "n
549    (erlang-skel-separator 2)
550    "handle_event(_Event, State) ->" n>
551    "{ok, State}." n
552    n
553    (erlang-skel-separator 2)
554    "%% Function: " n
555    "%% handle_call(Request, State) -> {ok, Reply, State} |" n
556    "%%                                {swap_handler, Reply, Args1, State1, "n
557    "%%                                  Mod2, Args2} |" n
558    "%%                                {remove_handler, Reply}" n
559    "%% Description: Whenever an event manager receives a request sent using"n
560    "%% gen_event:call/3,4, this function is called for the specified event "n
561    "%% handler to handle the request."n
562    (erlang-skel-separator 2)
563    "handle_call(_Request, State) ->" n>
564    "Reply = ok," n>
565    "{ok, Reply, State}." n
566    n
567    (erlang-skel-separator 2)
568    "%% Function: " n
569    "%% handle_info(Info, State) -> {ok, State} |" n
570    "%%                             {swap_handler, Args1, State1, Mod2, Args2} |" n
571    "%%                              remove_handler" n
572    "%% Description: This function is called for each installed event handler when"n
573    "%% an event manager receives any other message than an event or a synchronous"n
574    "%% request (or a system message)."n
575    (erlang-skel-separator 2)
576    "handle_info(_Info, State) ->" n>
577    "{ok, State}." n
578    n
579    (erlang-skel-separator 2)
580    "%% Function: terminate(Reason, State) -> void()" n
581    "%% Description:Whenever an event handler is deleted from an event manager,"n
582    "%% this function is called. It should be the opposite of Module:init/1 and "n
583    "%% do any necessary cleaning up. " n
584    (erlang-skel-separator 2)
585    "terminate(_Reason, _State) ->" n>
586    "ok." n
587    n
588    (erlang-skel-separator 2)
589    "%% Function: code_change(OldVsn, State, Extra) -> {ok, NewState} " n
590    "%% Description: Convert process state when code is changed" n
591    (erlang-skel-separator 2)
592    "code_change(_OldVsn, State, _Extra) ->" n>
593    "{ok, State}." n
594    n
595    (erlang-skel-separator 2)
596    "%%% Internal functions" n
597    (erlang-skel-separator 2)
598    )
599  "*The template of a gen_event.
600Please see the function `tempo-define-template'.")
601
602(defvar erlang-skel-gen-fsm
603  '((erlang-skel-include erlang-skel-large-header)
604    "-behaviour(gen_fsm)." n n
605
606    "%% API" n
607    "-export([start_link/0])." n n
608
609    "%% gen_fsm callbacks" n
610    "-export([init/1, state_name/2, state_name/3, handle_event/3," n>
611    "handle_sync_event/4, handle_info/3, terminate/3, code_change/4])." n n
612
613    "-record(state, {})." n n
614
615    (erlang-skel-double-separator 2)
616    "%% API" n
617    (erlang-skel-double-separator 2)
618    (erlang-skel-separator 2)
619    "%% Function: start_link() -> ok,Pid} | ignore | {error,Error}" n
620    "%% Description:Creates a gen_fsm process which calls Module:init/1 to"n
621    "%% initialize. To ensure a synchronized start-up procedure, this function" n
622    "%% does not return until Module:init/1 has returned.  " n
623    (erlang-skel-separator 2)
624    "start_link() ->" n>
625    "gen_fsm:start_link({local, ?SERVER}, ?MODULE, [], [])." n
626    n
627    (erlang-skel-double-separator 2)
628    "%% gen_fsm callbacks" n
629    (erlang-skel-double-separator 2)
630    (erlang-skel-separator 2)
631    "%% Function: init(Args) -> {ok, StateName, State} |" n
632    "%%                         {ok, StateName, State, Timeout} |" n
633    "%%                         ignore                              |" n
634    "%%                         {stop, StopReason}                   " n
635    "%% Description:Whenever a gen_fsm is started using gen_fsm:start/[3,4] or"n
636    "%% gen_fsm:start_link/3,4, this function is called by the new process to "n
637    "%% initialize. " n
638    (erlang-skel-separator 2)
639    "init([]) ->" n>
640    "{ok, state_name, #state{}}." n
641    n
642    (erlang-skel-separator 2)
643    "%% Function: "n
644    "%% state_name(Event, State) -> {next_state, NextStateName, NextState}|" n
645    "%%                             {next_state, NextStateName, " n
646    "%%                                NextState, Timeout} |" n
647    "%%                             {stop, Reason, NewState}" n
648    "%% Description:There should be one instance of this function for each possible"n
649    "%% state name. Whenever a gen_fsm receives an event sent using" n
650    "%% gen_fsm:send_event/2, the instance of this function with the same name as"n
651    "%% the current state name StateName is called to handle the event. It is also "n
652    "%% called if a timeout occurs. " n
653    (erlang-skel-separator 2)
654    "state_name(_Event, State) ->" n>
655    "{next_state, state_name, State}." n
656    n
657    (erlang-skel-separator 2)
658    "%% Function:" n
659    "%% state_name(Event, From, State) -> {next_state, NextStateName, NextState} |"n
660    "%%                                   {next_state, NextStateName, " n
661    "%%                                     NextState, Timeout} |" n
662    "%%                                   {reply, Reply, NextStateName, NextState}|"n
663    "%%                                   {reply, Reply, NextStateName, " n
664    "%%                                    NextState, Timeout} |" n
665    "%%                                   {stop, Reason, NewState}|" n
666    "%%                                   {stop, Reason, Reply, NewState}" n
667    "%% Description: There should be one instance of this function for each" n
668    "%% possible state name. Whenever a gen_fsm receives an event sent using" n
669    "%% gen_fsm:sync_send_event/2,3, the instance of this function with the same"n
670    "%% name as the current state name StateName is called to handle the event." n
671    (erlang-skel-separator 2)
672    "state_name(_Event, _From, State) ->" n>
673    "Reply = ok," n>
674    "{reply, Reply, state_name, State}." n
675    n
676    (erlang-skel-separator 2)
677    "%% Function: " n
678    "%% handle_event(Event, StateName, State) -> {next_state, NextStateName, "n
679    "%%						  NextState} |" n
680    "%%                                          {next_state, NextStateName, "n
681    "%%					          NextState, Timeout} |" n
682    "%%                                          {stop, Reason, NewState}" n
683    "%% Description: Whenever a gen_fsm receives an event sent using"n
684    "%% gen_fsm:send_all_state_event/2, this function is called to handle"n
685    "%% the event." n
686    (erlang-skel-separator 2)
687    "handle_event(_Event, StateName, State) ->" n>
688    "{next_state, StateName, State}." n
689    n
690    (erlang-skel-separator 2)
691    "%% Function: " n
692    "%% handle_sync_event(Event, From, StateName, "n
693    "%%                   State) -> {next_state, NextStateName, NextState} |" n
694    "%%                             {next_state, NextStateName, NextState, " n
695    "%%                              Timeout} |" n
696    "%%                             {reply, Reply, NextStateName, NextState}|" n
697    "%%                             {reply, Reply, NextStateName, NextState, " n
698    "%%                              Timeout} |" n
699    "%%                             {stop, Reason, NewState} |" n
700    "%%                             {stop, Reason, Reply, NewState}" n
701    "%% Description: Whenever a gen_fsm receives an event sent using"n
702    "%% gen_fsm:sync_send_all_state_event/2,3, this function is called to handle"n
703    "%% the event."n
704    (erlang-skel-separator 2)
705    "handle_sync_event(Event, From, StateName, State) ->" n>
706    "Reply = ok," n>
707    "{reply, Reply, StateName, State}." n
708    n
709    (erlang-skel-separator 2)
710    "%% Function: " n
711    "%% handle_info(Info,StateName,State)-> {next_state, NextStateName, NextState}|" n
712    "%%                                     {next_state, NextStateName, NextState, "n
713    "%%                                       Timeout} |" n
714    "%%                                     {stop, Reason, NewState}" n
715    "%% Description: This function is called by a gen_fsm when it receives any"n
716    "%% other message than a synchronous or asynchronous event"n
717    "%% (or a system message)." n
718    (erlang-skel-separator 2)
719    "handle_info(_Info, StateName, State) ->" n>
720    "{next_state, StateName, State}." n
721    n
722    (erlang-skel-separator 2)
723    "%% Function: terminate(Reason, StateName, State) -> void()" n
724    "%% Description:This function is called by a gen_fsm when it is about"n
725    "%% to terminate. It should be the opposite of Module:init/1 and do any"n
726    "%% necessary cleaning up. When it returns, the gen_fsm terminates with"n
727    "%% Reason. The return value is ignored." n
728    (erlang-skel-separator 2)
729    "terminate(_Reason, _StateName, _State) ->" n>
730    "ok." n
731    n
732    (erlang-skel-separator 2)
733    "%% Function:" n
734    "%% code_change(OldVsn, StateName, State, Extra) -> {ok, StateName, NewState}" n
735    "%% Description: Convert process state when code is changed" n
736    (erlang-skel-separator 2)
737    "code_change(_OldVsn, StateName, State, _Extra) ->" n>
738    "{ok, StateName, State}." n
739    n
740    (erlang-skel-separator 2)
741    "%%% Internal functions" n
742    (erlang-skel-separator 2)
743    )
744  "*The template of a gen_fsm.
745Please see the function `tempo-define-template'.")
746
747(defvar erlang-skel-lib
748  '((erlang-skel-include erlang-skel-large-header)
749
750    "%% API" n
751    "-export([])." n n
752
753    (erlang-skel-double-separator 2)
754    "%% API" n
755    (erlang-skel-double-separator 2)
756    (erlang-skel-separator 2)
757    "%% Function: " n
758    "%% Description:" n
759    (erlang-skel-separator 2)
760    n
761    (erlang-skel-double-separator 2)
762    "%% Internal functions" n
763    (erlang-skel-double-separator 2)
764    )
765  "*The template of a library module.
766Please see the function `tempo-define-template'.")
767
768(defvar erlang-skel-corba-callback
769  '((erlang-skel-include erlang-skel-large-header)
770    "%% Include files" n n
771
772    "%% API" n
773    "-export([])." n n
774
775    "%% Corba callbacks" n
776    "-export([init/1, terminate/2, code_change/3])." n n
777
778    "-record(state, {})." n n
779
780    (erlang-skel-double-separator 2)
781    "%% Corba callbacks" n
782    (erlang-skel-double-separator 2)
783    (erlang-skel-separator 2)
784    "%% Function: init(Args) -> {ok, State} |" n
785    "%%                         {ok, State, Timeout} |" n
786    "%%                         ignore               |" n
787    "%%                         {stop, Reason}" n
788    "%% Description: Initializes the server" n
789    (erlang-skel-separator 2)
790    "init([]) ->" n>
791    "{ok, #state{}}." n
792    n
793    (erlang-skel-separator 2)
794    "%% Function: terminate(Reason, State) -> void()" n
795    "%% Description: Shutdown the server" n
796    (erlang-skel-separator 2)
797    "terminate(_Reason, _State) ->" n>
798    "ok." n
799    n
800    (erlang-skel-separator 2)
801    "%% Function: code_change(OldVsn, State, Extra) -> {ok, NewState} " n
802    "%% Description: Convert process state when code is changed" n
803    (erlang-skel-separator 2)
804    "code_change(_OldVsn, State, _Extra) ->" n>
805    "{ok, State}." n
806    n
807    (erlang-skel-double-separator 2)
808    "%% Internal functions" n
809    (erlang-skel-double-separator 2)
810    )
811  "*The template of a library module.
812Please see the function `tempo-define-template'.")
813
814(defvar erlang-skel-ts-test-suite
815 '((erlang-skel-include erlang-skel-large-header)
816   "%% Note: This directive should only be used in test suites." n
817    "-compile(export_all)." n n
818
819    "-include_lib(\"common_test/include/ct.hrl\")." n n
820
821    (erlang-skel-separator 2)
822    "%% TEST SERVER CALLBACK FUNCTIONS" n
823    (erlang-skel-separator 2)
824    n
825    (erlang-skel-separator 2)
826    "%% Function: init_per_suite(Config0) -> Config1 | {skip,Reason}" n
827    "%%" n
828    "%% Config0 = Config1 = [tuple()]" n
829    "%%   A list of key/value pairs, holding the test case configuration." n
830    "%% Reason = term()" n
831    "%%   The reason for skipping the suite." n
832    "%%" n
833    "%% Description: Initialization before the suite." n
834    "%%" n
835    "%% Note: This function is free to add any key/value pairs to the Config" n
836    "%% variable, but should NOT alter/remove any existing entries." n
837    (erlang-skel-separator 2)
838    "init_per_suite(Config) ->" n >
839    "Config." n n
840
841    (erlang-skel-separator 2)
842    "%% Function: end_per_suite(Config) -> term()" n
843    "%%" n
844    "%% Config = [tuple()]" n
845    "%%   A list of key/value pairs, holding the test case configuration." n
846    "%%" n
847    "%% Description: Cleanup after the suite." n
848    (erlang-skel-separator 2)
849    "end_per_suite(_Config) ->" n >
850    "ok." n n
851
852    (erlang-skel-separator 2)
853    "%% Function: init_per_testcase(TestCase, Config0) -> Config1 |" n
854    "%%                                                   {skip,Reason}" n
855    "%% TestCase = atom()" n
856    "%%   Name of the test case that is about to run." n
857    "%% Config0 = Config1 = [tuple()]" n
858    "%%   A list of key/value pairs, holding the test case configuration." n
859    "%% Reason = term()" n
860    "%%   The reason for skipping the test case." n
861    "%%" n
862    "%% Description: Initialization before each test case." n
863    "%%" n
864    "%% Note: This function is free to add any key/value pairs to the Config" n
865    "%% variable, but should NOT alter/remove any existing entries." n
866    (erlang-skel-separator 2)
867    "init_per_testcase(_TestCase, Config) ->" n >
868    "Config." n n
869
870    (erlang-skel-separator 2)
871    "%% Function: end_per_testcase(TestCase, Config) -> term()" n
872    "%%" n
873    "%% TestCase = atom()" n
874    "%%   Name of the test case that is finished." n
875    "%% Config = [tuple()]" n
876    "%%   A list of key/value pairs, holding the test case configuration." n
877    "%%" n
878    "%% Description: Cleanup after each test case." n
879    (erlang-skel-separator 2)
880    "end_per_testcase(_TestCase, _Config) ->" n >
881    "ok."n n
882
883    (erlang-skel-separator 2)
884    "%% Function: all(Clause) -> Descr | Spec | {skip,Reason}" n
885    "%%" n
886    "%% Clause = doc | suite" n
887    "%%   Indicates expected return value." n
888    "%% Descr = [string()] | []" n
889    "%%   String that describes the test suite." n
890    "%% Spec = [TestCase]" n
891    "%%   A test specification." n
892    "%% TestCase = ConfCase | atom()" n
893    "%%   Configuration case, or the name of a test case function." n
894    "%% ConfCase = {conf,Init,Spec,End} |" n
895    "%%            {conf,Properties,Init,Spec,End}" n
896    "%% Init = End = {Mod,Func} | Func" n
897    "%%   Initialization and cleanup function." n
898    "%% Mod = Func = atom()" n
899    "%% Properties = [parallel | sequence | Shuffle | {RepeatType,N}]" n
900    "%%   Execution properties of the test cases (may be combined)." n
901    "%% Shuffle = shuffle | {shuffle,Seed}" n
902    "%%   To get cases executed in random order." n
903    "%% Seed = {integer(),integer(),integer()}" n
904    "%% RepeatType = repeat | repeat_until_all_ok | repeat_until_all_fail |" n
905    "%%              repeat_until_any_ok | repeat_until_any_fail" n
906    "%%   To get execution of cases repeated." n
907    "%% N = integer() | forever" n
908    "%% Reason = term()" n
909    "%%   The reason for skipping the test suite." n
910    "%%" n
911    "%% Description: Returns a description of the test suite when" n
912    "%%              Clause == doc, and a test specification (list" n
913    "%%              of the conf and test cases in the suite) when" n
914    "%%              Clause == suite." n
915    (erlang-skel-separator 2)
916    "all(doc) -> " n >
917    "[\"Describe the main purpose of this suite\"];" n n
918    "all(suite) -> " n >
919    "[a_test_case]." n n
920    n
921    (erlang-skel-separator 2)
922    "%% TEST CASES" n
923    (erlang-skel-separator 2)
924    n
925    (erlang-skel-separator 2)
926    "%% Function: TestCase(Arg) -> Descr | Spec | ok | exit() | {skip,Reason}" n
927    "%%" n
928    "%% Arg = doc | suite | Config" n
929    "%%   Indicates expected behaviour and return value." n
930    "%% Config = [tuple()]" n
931    "%%   A list of key/value pairs, holding the test case configuration." n
932    "%% Descr = [string()] | []" n
933    "%%   String that describes the test case." n
934    "%% Spec = [tuple()] | []" n
935    "%%   A test specification, see all/1." n
936    "%% Reason = term()" n
937    "%%   The reason for skipping the test case." n
938    "%%" n
939    "%% Description: Test case function. Returns a description of the test" n
940    "%%              case (doc), then returns a test specification (suite)," n
941    "%%              or performs the actual test (Config)." n
942    (erlang-skel-separator 2)
943    "a_test_case(doc) -> " n >
944    "[\"Describe the main purpose of this test case\"];" n n
945    "a_test_case(suite) -> " n >
946    "[];" n n
947    "a_test_case(Config) when is_list(Config) -> " n >
948    "ok." n
949   )
950 "*The template of a library module.
951Please see the function `tempo-define-template'.")
952
953(defvar erlang-skel-ct-test-suite-l
954 '((erlang-skel-include erlang-skel-large-header)
955   "%% Note: This directive should only be used in test suites." n
956    "-compile(export_all)." n n
957
958    "-include_lib(\"common_test/include/ct.hrl\")." n n
959
960    (erlang-skel-separator 2)
961    "%% COMMON TEST CALLBACK FUNCTIONS" n
962    (erlang-skel-separator 2)
963    n
964    (erlang-skel-separator 2)
965    "%% Function: suite() -> Info" n
966    "%%" n
967    "%% Info = [tuple()]" n
968    "%%   List of key/value pairs." n
969    "%%" n
970    "%% Description: Returns list of tuples to set default properties" n
971    "%%              for the suite." n
972    "%%" n
973    "%% Note: The suite/0 function is only meant to be used to return" n
974    "%% default data values, not perform any other operations." n
975    (erlang-skel-separator 2)
976    "suite() ->" n >
977    "[{timetrap,{minutes,10}}]." n n
978
979    (erlang-skel-separator 2)
980    "%% Function: init_per_suite(Config0) ->" n
981    "%%               Config1 | {skip,Reason} | {skip_and_save,Reason,Config1}" n
982    "%%" n
983    "%% Config0 = Config1 = [tuple()]" n
984    "%%   A list of key/value pairs, holding the test case configuration." n
985    "%% Reason = term()" n
986    "%%   The reason for skipping the suite." n
987    "%%" n
988    "%% Description: Initialization before the suite." n
989    "%%" n
990    "%% Note: This function is free to add any key/value pairs to the Config" n
991    "%% variable, but should NOT alter/remove any existing entries." n
992    (erlang-skel-separator 2)
993    "init_per_suite(Config) ->" n >
994    "Config." n n
995
996    (erlang-skel-separator 2)
997    "%% Function: end_per_suite(Config0) -> term() | {save_config,Config1}" n
998    "%%" n
999    "%% Config0 = Config1 = [tuple()]" n
1000    "%%   A list of key/value pairs, holding the test case configuration." n
1001    "%%" n
1002    "%% Description: Cleanup after the suite." n
1003    (erlang-skel-separator 2)
1004    "end_per_suite(_Config) ->" n >
1005    "ok." n n
1006
1007    (erlang-skel-separator 2)
1008    "%% Function: init_per_group(GroupName, Config0) ->" n
1009    "%%               Config1 | {skip,Reason} | {skip_and_save,Reason,Config1}" n
1010    "%%" n
1011    "%% GroupName = atom()" n
1012    "%%   Name of the test case group that is about to run." n
1013    "%% Config0 = Config1 = [tuple()]" n
1014    "%%   A list of key/value pairs, holding configuration data for the group." n
1015    "%% Reason = term()" n
1016    "%%   The reason for skipping all test cases and subgroups in the group." n
1017    "%%" n
1018    "%% Description: Initialization before each test case group." n
1019    (erlang-skel-separator 2)
1020    "init_per_group(_GroupName, Config) ->" n >
1021    "Config." n n
1022
1023    (erlang-skel-separator 2)
1024    "%% Function: end_per_group(GroupName, Config0) ->" n
1025    "%%               term() | {save_config,Config1}" n
1026    "%%" n
1027    "%% GroupName = atom()" n
1028    "%%   Name of the test case group that is finished." n
1029    "%% Config0 = Config1 = [tuple()]" n
1030    "%%   A list of key/value pairs, holding configuration data for the group." n
1031    "%%" n
1032    "%% Description: Cleanup after each test case group." n
1033    (erlang-skel-separator 2)
1034    "end_per_group(_GroupName, _Config) ->" n >
1035    "ok." n n
1036
1037    (erlang-skel-separator 2)
1038    "%% Function: init_per_testcase(TestCase, Config0) ->" n
1039    "%%               Config1 | {skip,Reason} | {skip_and_save,Reason,Config1}" n
1040    "%%" n
1041    "%% TestCase = atom()" n
1042    "%%   Name of the test case that is about to run." n
1043    "%% Config0 = Config1 = [tuple()]" n
1044    "%%   A list of key/value pairs, holding the test case configuration." n
1045    "%% Reason = term()" n
1046    "%%   The reason for skipping the test case." n
1047    "%%" n
1048    "%% Description: Initialization before each test case." n
1049    "%%" n
1050    "%% Note: This function is free to add any key/value pairs to the Config" n
1051    "%% variable, but should NOT alter/remove any existing entries." n
1052    (erlang-skel-separator 2)
1053    "init_per_testcase(_TestCase, Config) ->" n >
1054    "Config." n n
1055
1056    (erlang-skel-separator 2)
1057    "%% Function: end_per_testcase(TestCase, Config0) ->" n
1058    "%%               term() | {save_config,Config1} | {fail,Reason}" n
1059    "%%" n
1060    "%% TestCase = atom()" n
1061    "%%   Name of the test case that is finished." n
1062    "%% Config0 = Config1 = [tuple()]" n
1063    "%%   A list of key/value pairs, holding the test case configuration." n
1064    "%% Reason = term()" n
1065    "%%   The reason for failing the test case." n
1066    "%%" n
1067    "%% Description: Cleanup after each test case." n
1068    (erlang-skel-separator 2)
1069    "end_per_testcase(_TestCase, _Config) ->" n >
1070    "ok." n n
1071
1072    (erlang-skel-separator 2)
1073    "%% Function: groups() -> [Group]" n
1074    "%%" n
1075    "%% Group = {GroupName,Properties,GroupsAndTestCases}" n
1076    "%% GroupName = atom()" n
1077    "%%   The name of the group." n
1078    "%% Properties = [parallel | sequence | Shuffle | {RepeatType,N}]" n
1079    "%%   Group properties that may be combined." n
1080    "%% GroupsAndTestCases = [Group | {group,GroupName} | TestCase]" n
1081    "%% TestCase = atom()" n
1082    "%%   The name of a test case." n
1083    "%% Shuffle = shuffle | {shuffle,Seed}" n
1084    "%%   To get cases executed in random order." n
1085    "%% Seed = {integer(),integer(),integer()}" n
1086    "%% RepeatType = repeat | repeat_until_all_ok | repeat_until_all_fail |" n
1087    "%%              repeat_until_any_ok | repeat_until_any_fail" n
1088    "%%   To get execution of cases repeated." n
1089    "%% N = integer() | forever" n
1090    "%%" n
1091    "%% Description: Returns a list of test case group definitions." n
1092    (erlang-skel-separator 2)
1093    "groups() ->" n >
1094    "[]." n n
1095
1096    (erlang-skel-separator 2)
1097    "%% Function: all() -> GroupsAndTestCases | {skip,Reason}" n
1098    "%%" n
1099    "%% GroupsAndTestCases = [{group,GroupName} | TestCase]" n
1100    "%% GroupName = atom()" n
1101    "%%   Name of a test case group." n
1102    "%% TestCase = atom()" n
1103    "%%   Name of a test case." n
1104    "%% Reason = term()" n
1105    "%%   The reason for skipping all groups and test cases." n
1106    "%%" n
1107    "%% Description: Returns the list of groups and test cases that" n
1108    "%%              are to be executed." n
1109    (erlang-skel-separator 2)
1110    "all() -> " n >
1111    "[my_test_case]." n n
1112
1113    n
1114    (erlang-skel-separator 2)
1115    "%% TEST CASES" n
1116    (erlang-skel-separator 2)
1117    n
1118
1119    (erlang-skel-separator 2)
1120    "%% Function: TestCase() -> Info" n
1121    "%%" n
1122    "%% Info = [tuple()]" n
1123    "%%   List of key/value pairs." n
1124    "%%" n
1125    "%% Description: Test case info function - returns list of tuples to set" n
1126    "%%              properties for the test case." n
1127    "%%" n
1128    "%% Note: This function is only meant to be used to return a list of" n
1129    "%% values, not perform any other operations." n
1130    (erlang-skel-separator 2)
1131    "my_test_case() -> " n >
1132    "[]." n n
1133
1134    (erlang-skel-separator 2)
1135    "%% Function: TestCase(Config0) ->" n
1136    "%%               ok | exit() | {skip,Reason} | {comment,Comment} |" n
1137    "%%               {save_config,Config1} | {skip_and_save,Reason,Config1}" n
1138    "%%" n
1139    "%% Config0 = Config1 = [tuple()]" n
1140    "%%   A list of key/value pairs, holding the test case configuration." n
1141    "%% Reason = term()" n
1142    "%%   The reason for skipping the test case." n
1143    "%% Comment = term()" n
1144    "%%   A comment about the test case that will be printed in the html log." n
1145    "%%" n
1146    "%% Description: Test case function. (The name of it must be specified in" n
1147    "%%              the all/0 list or in a test case group for the test case" n
1148    "%%              to be executed)." n
1149    (erlang-skel-separator 2)
1150    "my_test_case(_Config) -> " n >
1151    "ok." n
1152    )
1153 "*The template of a library module.
1154Please see the function `tempo-define-template'.")
1155
1156(defvar erlang-skel-ct-test-suite-s
1157 '((erlang-skel-include erlang-skel-large-header)
1158    "-compile(export_all)." n n
1159
1160    "-include_lib(\"common_test/include/ct.hrl\")." n n
1161
1162    (erlang-skel-separator 2)
1163    "%% Function: suite() -> Info" n
1164    "%% Info = [tuple()]" n
1165    (erlang-skel-separator 2)
1166    "suite() ->" n >
1167    "[{timetrap,{seconds,30}}]." n n
1168
1169    (erlang-skel-separator 2)
1170    "%% Function: init_per_suite(Config0) ->" n
1171    "%%               Config1 | {skip,Reason} | {skip_and_save,Reason,Config1}" n
1172    "%% Config0 = Config1 = [tuple()]" n
1173    "%% Reason = term()" n
1174    (erlang-skel-separator 2)
1175    "init_per_suite(Config) ->" n >
1176    "Config." n n
1177
1178    (erlang-skel-separator 2)
1179    "%% Function: end_per_suite(Config0) -> term() | {save_config,Config1}" n
1180    "%% Config0 = Config1 = [tuple()]" n
1181    (erlang-skel-separator 2)
1182    "end_per_suite(_Config) ->" n >
1183    "ok." n n
1184
1185    (erlang-skel-separator 2)
1186    "%% Function: init_per_group(GroupName, Config0) ->" n
1187    "%%               Config1 | {skip,Reason} | {skip_and_save,Reason,Config1}" n
1188    "%% GroupName = atom()" n
1189    "%% Config0 = Config1 = [tuple()]" n
1190    "%% Reason = term()" n
1191    (erlang-skel-separator 2)
1192    "init_per_group(_GroupName, Config) ->" n >
1193    "Config." n n
1194
1195    (erlang-skel-separator 2)
1196    "%% Function: end_per_group(GroupName, Config0) ->" n
1197    "%%               term() | {save_config,Config1}" n
1198    "%% GroupName = atom()" n
1199    "%% Config0 = Config1 = [tuple()]" n
1200    (erlang-skel-separator 2)
1201    "end_per_group(_GroupName, _Config) ->" n >
1202    "ok." n n
1203
1204    (erlang-skel-separator 2)
1205    "%% Function: init_per_testcase(TestCase, Config0) ->" n
1206    "%%               Config1 | {skip,Reason} | {skip_and_save,Reason,Config1}" n
1207    "%% TestCase = atom()" n
1208    "%% Config0 = Config1 = [tuple()]" n
1209    "%% Reason = term()" n
1210    (erlang-skel-separator 2)
1211    "init_per_testcase(_TestCase, Config) ->" n >
1212    "Config." n n
1213
1214    (erlang-skel-separator 2)
1215    "%% Function: end_per_testcase(TestCase, Config0) ->" n
1216    "%%               term() | {save_config,Config1} | {fail,Reason}" n
1217    "%% TestCase = atom()" n
1218    "%% Config0 = Config1 = [tuple()]" n
1219    "%% Reason = term()" n
1220    (erlang-skel-separator 2)
1221    "end_per_testcase(_TestCase, _Config) ->" n >
1222    "ok." n n
1223
1224    (erlang-skel-separator 2)
1225    "%% Function: groups() -> [Group]" n
1226    "%% Group = {GroupName,Properties,GroupsAndTestCases}" n
1227    "%% GroupName = atom()" n
1228    "%% Properties = [parallel | sequence | Shuffle | {RepeatType,N}]" n
1229    "%% GroupsAndTestCases = [Group | {group,GroupName} | TestCase]" n
1230    "%% TestCase = atom()" n
1231    "%% Shuffle = shuffle | {shuffle,{integer(),integer(),integer()}}" n
1232    "%% RepeatType = repeat | repeat_until_all_ok | repeat_until_all_fail |" n
1233    "%%              repeat_until_any_ok | repeat_until_any_fail" n
1234    "%% N = integer() | forever" n
1235    (erlang-skel-separator 2)
1236    "groups() ->" n >
1237    "[]." n n
1238
1239    (erlang-skel-separator 2)
1240    "%% Function: all() -> GroupsAndTestCases | {skip,Reason}" n
1241    "%% GroupsAndTestCases = [{group,GroupName} | TestCase]" n
1242    "%% GroupName = atom()" n
1243    "%% TestCase = atom()" n
1244    "%% Reason = term()" n
1245    (erlang-skel-separator 2)
1246    "all() -> " n >
1247    "[my_test_case]." n n
1248
1249    (erlang-skel-separator 2)
1250    "%% Function: TestCase() -> Info" n
1251    "%% Info = [tuple()]" n
1252    (erlang-skel-separator 2)
1253    "my_test_case() -> " n >
1254    "[]." n n
1255
1256    (erlang-skel-separator 2)
1257    "%% Function: TestCase(Config0) ->" n
1258    "%%               ok | exit() | {skip,Reason} | {comment,Comment} |" n
1259    "%%               {save_config,Config1} | {skip_and_save,Reason,Config1}" n
1260    "%% Config0 = Config1 = [tuple()]" n
1261    "%% Reason = term()" n
1262    "%% Comment = term()" n
1263    (erlang-skel-separator 2)
1264    "my_test_case(_Config) -> " n >
1265    "ok." n
1266    )
1267 "*The template of a library module.
1268Please see the function `tempo-define-template'.")
1269