summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTuncer Ayaz <tuncer.ayaz@gmail.com>2017-08-19 16:34:23 +0000
committerTuncer Ayaz <tuncer.ayaz@gmail.com>2017-08-19 16:35:49 +0000
commitb65d3db2e0ccd313fa62c02f8759185567caee09 (patch)
treec49fb2cbb1822e5b5e8d408825a4572f7f9dc80b
parent0dcac8a88e9f140c343c28e2d42cebcdfb78bd04 (diff)
downloadrebar-b65d3db2e0ccd313fa62c02f8759185567caee09.tar.gz
Fix ctsuite template
- Fix and test the Erlang code. - Do not export_all.
-rw-r--r--priv/templates/ctsuite.erl29
1 files changed, 23 insertions, 6 deletions
diff --git a/priv/templates/ctsuite.erl b/priv/templates/ctsuite.erl
index 33a8fac..bed2ae6 100644
--- a/priv/templates/ctsuite.erl
+++ b/priv/templates/ctsuite.erl
@@ -3,7 +3,20 @@
-module({{testmod}}_SUITE).
-include_lib("common_test/include/ct.hrl").
--compile(export_all).
+-export([ suite/0
+ , groups/0
+ , all/0
+ , init_per_suite/1
+ , end_per_suite/1
+ , init_per_group/2
+ , end_per_group/2
+ , init_per_testcase/2
+ , end_per_testcase/2
+ ]).
+
+-export([ test_{{testmod}}/0
+ , test_{{testmod}}/1
+ ]).
%%--------------------------------------------------------------------
%% Function: suite() -> Info
@@ -57,12 +70,16 @@ groups() -> [].
%% NB: By default, we export all 1-arity user defined functions
%%--------------------------------------------------------------------
all() ->
- [ {exports, Functions} | _ ] = ?MODULE:module_info(),
+ { exports, Functions } = lists:keyfind(exports, 1, ?MODULE:module_info()),
[ FName || {FName, _} <- lists:filter(
fun ({module_info,_}) -> false;
({all,_}) -> false;
({init_per_suite,1}) -> false;
({end_per_suite,1}) -> false;
+ ({init_per_group,2}) -> false;
+ ({end_per_group,2}) -> false;
+ ({init_per_testcase,2}) -> false;
+ ({end_per_testcase,2}) -> false;
({_,1}) -> true;
({_,_}) -> false
end, Functions)].
@@ -108,7 +125,7 @@ end_per_suite(_Config) ->
%%
%% Description: Initialization before each test case group.
%%--------------------------------------------------------------------
-init_per_group(_group, Config) ->
+init_per_group(_GroupName, Config) ->
Config.
%%--------------------------------------------------------------------
@@ -122,7 +139,7 @@ init_per_group(_group, Config) ->
%%
%% Description: Cleanup after each test case group.
%%--------------------------------------------------------------------
-end_per_group(_group, Config) ->
+end_per_group(_GroupName, Config) ->
Config.
%%--------------------------------------------------------------------
@@ -141,7 +158,7 @@ end_per_group(_group, Config) ->
%% Note: This function is free to add any key/value pairs to the Config
%% variable, but should NOT alter/remove any existing entries.
%%--------------------------------------------------------------------
-init_per_testcase(TestCase, Config) ->
+init_per_testcase(_TestCase, Config) ->
Config.
%%--------------------------------------------------------------------
@@ -157,7 +174,7 @@ init_per_testcase(TestCase, Config) ->
%%
%% Description: Cleanup after each test case.
%%--------------------------------------------------------------------
-end_per_testcase(TestCase, Config) ->
+end_per_testcase(_TestCase, Config) ->
Config.
test_{{testmod}}() ->