home
/
code
/
hope.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Use empty tuple as unit type, for all side-effects.
[hope.git]
/
test
/
hope_option_SUITE.erl
diff --git
a/test/hope_option_SUITE.erl
b/test/hope_option_SUITE.erl
index
370cf24
..
d2a73a3
100644
(file)
--- a/
test/hope_option_SUITE.erl
+++ b/
test/hope_option_SUITE.erl
@@
-15,6
+15,7
@@
, t_map/1
, t_iter/1
, t_pipe/1
, t_map/1
, t_iter/1
, t_pipe/1
+ , t_validate/1
]).
]).
@@
-38,6
+39,7
@@
groups() ->
, t_map
, t_iter
, t_pipe
, t_map
, t_iter
, t_pipe
+ , t_validate
],
Properties = [parallel],
[ {?GROUP, Properties, Tests}
],
Properties = [parallel],
[ {?GROUP, Properties, Tests}
@@
-64,12
+66,12
@@
t_map(_Cfg) ->
t_iter(_Cfg) ->
Key = key,
t_iter(_Cfg) ->
Key = key,
- Put = fun (Val) ->
_ = put(Key, Val), ok
end,
+ Put = fun (Val) ->
put(Key, Val)
end,
Get = fun () -> get(Key) end,
Val = foo,
Get = fun () -> get(Key) end,
Val = foo,
-
ok
= hope_option:iter(none , Put),
+
{}
= hope_option:iter(none , Put),
undefined = Get(),
undefined = Get(),
-
ok
= hope_option:iter({some, Val}, Put),
+
{}
= hope_option:iter({some, Val}, Put),
Val = Get().
t_of_result(_Cfg) ->
Val = Get().
t_of_result(_Cfg) ->
@@
-99,3
+101,9
@@
t_of_undefined(_Cfg) ->
{some, Bar} = hope_option:of_undefined(Bar),
{some, Baz} = hope_option:of_undefined(Baz),
none = hope_option:of_undefined(undefined).
{some, Bar} = hope_option:of_undefined(Bar),
{some, Baz} = hope_option:of_undefined(Baz),
none = hope_option:of_undefined(undefined).
+
+t_validate(_Cfg) ->
+ IsFoo = fun (X) -> X =:= foo end,
+ none = hope_option:validate(none, IsFoo),
+ none = hope_option:validate({some, bar}, IsFoo),
+ {some, foo} = hope_option:validate({some, foo}, IsFoo).
This page took
0.028493 seconds
and
4
git commands to generate.