Fix hope_result test grouping.
[hope.git] / test / hope_result_SUITE.erl
CommitLineData
7e9d7f2c
SK
1-module(hope_result_SUITE).
2
8857d0f0 3%% TODO: Import only what is used.
8bbf6f4d
PO
4-include_lib("proper/include/proper.hrl").
5
7e9d7f2c
SK
6%% Callbacks
7-export(
8 [ all/0
9 , groups/0
126c8880
SK
10 , init_per_group/2
11 , end_per_group/2
7e9d7f2c
SK
12 ]).
13
14%% Test cases
15-export(
126c8880
SK
16 [ t_pipe_ok/1
17 , t_pipe_error/1
8bbf6f4d 18 , t_hope_result_specs/1
7e9d7f2c
SK
19 ]).
20
21
22-define(GROUP_PIPE, result_pipe).
8857d0f0 23-define(GROUP_SPEC, result_spec).
7e9d7f2c
SK
24
25
26%% ============================================================================
27%% Common Test callbacks
28%% ============================================================================
29
30all() ->
8857d0f0
SK
31 [ {group, ?GROUP_PIPE}
32 , {group, ?GROUP_SPEC}
33 ].
7e9d7f2c
SK
34
35groups() ->
8857d0f0 36 PipeTests =
126c8880
SK
37 [ t_pipe_ok
38 , t_pipe_error
8857d0f0
SK
39 ],
40 SpecTests =
41 [ t_hope_result_specs
7e9d7f2c 42 ],
8bbf6f4d 43 Properties = [parallel],
8857d0f0
SK
44 [ {?GROUP_PIPE, Properties, PipeTests}
45 , {?GROUP_SPEC, Properties, SpecTests}
46 ].
7e9d7f2c 47
8857d0f0
SK
48init_per_group(?GROUP_SPEC, Cfg) ->
49 Cfg;
126c8880 50init_per_group(?GROUP_PIPE, Cfg) ->
7e9d7f2c 51 Steps =
55182c1b
SK
52 [ fun (0) -> {ok, 1}; (X) -> {error, X} end
53 , fun (1) -> {ok, 2}; (X) -> {error, X} end
54 , fun (2) -> {ok, 3}; (X) -> {error, X} end
7e9d7f2c 55 ],
126c8880
SK
56 hope_kv_list:set(Cfg, steps, Steps).
57
8857d0f0
SK
58end_per_group(?GROUP_SPEC, _Cfg) ->
59 ok;
126c8880
SK
60end_per_group(?GROUP_PIPE, _Cfg) ->
61 ok.
62
63
64%% =============================================================================
65%% Test cases
66%% =============================================================================
67
68t_pipe_ok(Cfg) ->
69 {some, Steps} = hope_kv_list:get(Cfg, steps),
55182c1b 70 {ok, 3} = hope_result:pipe(Steps, 0).
126c8880
SK
71
72t_pipe_error(Cfg) ->
73 {some, Steps} = hope_kv_list:get(Cfg, steps),
74 {error, 1} = hope_result:pipe(Steps, 1).
8bbf6f4d
PO
75
76t_hope_result_specs(_) ->
77 [] = proper:check_specs(hope_result).
This page took 0.031005 seconds and 4 git commands to generate.