Skip to content

Commit

Permalink
Convert CT Suite edoc type specs to real specs
Browse files Browse the repository at this point in the history
  • Loading branch information
mbbx6spp committed Jun 13, 2011
1 parent 7038ae4 commit 72b4b79
Showing 1 changed file with 68 additions and 62 deletions.
130 changes: 68 additions & 62 deletions ctsuite.erl
Expand Up @@ -12,113 +12,119 @@
%%%. %%%.
%%%' CALLBACKS %%%' CALLBACKS


%% @spec suite() -> Config
%% where
%% Config = [tuple()]
%% @doc returns list of tuples to set default properties for the suite. %% @doc returns list of tuples to set default properties for the suite.
-spec suite() -> Config
when
Config :: proplist().
suite() -> suite() ->
[{timetrap,{minutes,10}}]. [{timetrap,{minutes,10}}].


%% @spec init_per_suite(Config0) ->
%% Config1 | {skip, Reason} | {skip_and_save, Reason, Config1}
%% where
%% Config0 = Config1 = [tuple()],
%% Reason = term()
%% @doc runs initialization before matching test suite is executed. %% @doc runs initialization before matching test suite is executed.
%% This function may add key/value pairs to Config. %% This function may add key/value pairs to Config.
-spec init_per_suite(Config0) ->
Config1 | {skip, Reason} | {skip_and_save, Reason, Config1}
when
Config0 :: proplist(),
Config1 :: proplist(),
Reason :: term().
init_per_suite(Config) -> init_per_suite(Config) ->
Config. Config.


%% @spec end_per_suite(Config0) -> ok | {save_config, Config1}
%% where
%% Config0 = Config1 = [tuple()]
%% @doc runs cleanup after matching test suite is executed. %% @doc runs cleanup after matching test suite is executed.
-spec end_per_suite(Config0) -> ok | {save_config, Config1}
when
Config0 :: proplist(),
Config1 :: proplist().
end_per_suite(_Config) -> end_per_suite(_Config) ->
ok. ok.


%% @spec init_per_group(GroupName, Config0) ->
%% Config1 | {skip, Reason} | {skip_and_save, Reason, Config1}
%% where
%% GroupName = atom(),
%% Config0 = Config1 = [tuple()],
%% Reason = term()
%% @doc runs initialization before matching test group is executed. %% @doc runs initialization before matching test group is executed.
-spec init_per_group(GroupName, Config0) ->
Config1 | {skip, Reason} | {skip_and_save, Reason, Config1}
when
GroupName :: string(),
Config0 :: proplist(),
Config1 :: proplist(),
Reason :: term().
init_per_group(_GroupName, Config) -> init_per_group(_GroupName, Config) ->
Config. Config.


%% @spec end_per_group(GroupName, Config0) -> ok | {save_config, Config1}
%% where
%% GroupName = atom(),
%% Config0 = Config1 = [tuple()]
%% @doc runs cleanup after matching test group is fully executed. %% @doc runs cleanup after matching test group is fully executed.
-spec end_per_group(GroupName, Config0) -> ok | {save_config, Config1}
when
GroupName :: string(),
Config0 :: proplist(),
Config1 :: proplist().
end_per_group(_GroupName, _Config) -> end_per_group(_GroupName, _Config) ->
ok. ok.


%% @spec init_per_testcase(TestCase, Config0) ->
%% Config1 | {skip, Reason} | {skip_and_save, Reason, Config1}
%% where
%% TestCase = atom(),
%% Config0 = Config1 = [tuple],
%% Reason = term()
%% @doc runs initialization before matching test case. Should not alter or %% @doc runs initialization before matching test case. Should not alter or
%% remove any key/value pairs to the Config, but may add to it. %% remove any key/value pairs to the Config, but may add to it.
-spec init_per_testcase(TestCase, Config0) ->
when
TestCase :: atom(),
Config0 :: proplist(),
Config1 :: proplist(),
Reason :: term().
init_per_testcase(_TestCase, Config) -> init_per_testcase(_TestCase, Config) ->
Config. Config.


%% @spec end_per_testcase(TestCase, Config0) ->
%% ok | {save_config, Config1} | {fail, Reason}
%% where
%% TestCase = atom(),
%% Config0 = Config1 = [tuple()],
%% Reason = term()
%% @doc runs cleanup for matching test case. %% @doc runs cleanup for matching test case.
-spec end_per_testcase(TestCase, Config0) ->
ok | {save_config, Config1} | {fail, Reason}
when
TestCase :: atom(),
Config0 :: proplist(),
Config1 :: proplist(),
Reason :: term().
end_per_testcase(_TestCase, _Config) -> end_per_testcase(_TestCase, _Config) ->
ok. ok.


%% @spec groups() -> [Group]
%% where
%% Group = {GroupName, Properties, Members},
%% GroupName = atom(),
%% Properties = [parallel | sequence | Shuffle | {RepeatType, N}],
%% Members = [Group | {group, GroupName} | TestCase],
%% TestCase = atom(),
%% Shuffle = shuffle | {shuffle, Seed},
%% Seed = {integer(), integer(), integer()},
%% RepeatType = repeat | repeat_until_all_ok | repeat_until_all_fail |
%% repeat_until_any_ok | repeat_until_any_fail
%% N = integer() | forever
%% @doc returns list of test case group definitions. %% @doc returns list of test case group definitions.
-spec groups() -> [Group]
when
Group :: {GroupName, Properties, Members},
GroupName :: atom(),
Properties :: [parallel | sequence | Shuffle | {RepeatType, N}],
Members :: [Group | {group, GroupName} | TestCase],
TestCase :: atom(),
Shuffle :: shuffle | {shuffle, Seed},
Seed :: {integer(), integer(), integer()},
RepeatType :: repeat | repeat_until_all_ok | repeat_until_all_fail |
repeat_until_any_ok | repeat_until_any_fail
N :: integer() | forever.
groups() -> groups() ->
[]. [].


%% @spec all() -> Tests | {skip, Reason}
%% where
%% Tests = [{group, GroupName} | TestCase],
%% GroupName = atom(),
%% TestCase = atom(),
%% Reason = term()
%% @doc returns list of tests (group or testcase) to be run for all of suite. %% @doc returns list of tests (group or testcase) to be run for all of suite.
-spec all() -> Tests | {skip, Reason}
when
Test :: {group, GroupName} | TestCase,
Tests :: [Test],
GroupName :: atom(),
TestCase :: atom(),
Reason :: term().
all() -> all() ->
[my_test_case]. [my_test_case].


%%%. %%%.
%%%' TESTCASES %%%' TESTCASES


%% @spec TestCase() -> Info %% @doc returns list of tuples to set info properties for the test case.
%% where -spec my_test_case() -> Info
%% Info = [tuple()] when
%% @doc returns list of tuples to set properties for the test case. Info :: proplist().
my_test_case() -> my_test_case() ->
[]. [].


%% @spec TestCase(Config0) ->
%% ok | exit() | {skip, Reason} | {comment, Comment} |
%% {save_config, Config} | {skip_and_save, Reason, Config1}
%% where
%% Config0 = Config1 = [tuple()],
%% Reason = term(),
%% Comment = term()
%% @doc the test function. %% @doc the test function.
@spec TestCase(Config0) ->
ok | exit() | {skip, Reason} | {comment, Comment} |
{save_config, Config} | {skip_and_save, Reason, Config1}
when
Config0 :: Config1 :: proplist(),
Reason :: term(),
Comment :: term()
my_test_case(_Config) -> my_test_case(_Config) ->
ok. ok.
%%%. %%%.
Expand Down

0 comments on commit 72b4b79

Please sign in to comment.