%% Test cases
-export(
[ t_of_result/1
- , t_of_undefined/1
+ , t_undefined/1
, t_put/1
, t_get/1
, t_map/1
groups() ->
Tests =
[ t_of_result
- , t_of_undefined
+ , t_undefined
, t_put
, t_get
, t_map
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,
- ok = hope_option:iter(none , Put),
+ {} = hope_option:iter(none , Put),
undefined = Get(),
- ok = hope_option:iter({some, Val}, Put),
+ {} = hope_option:iter({some, Val}, Put),
Val = Get().
t_of_result(_Cfg) ->
none = hope_option:pipe(Steps, 2),
none = hope_option:pipe(Steps, 3).
-t_of_undefined(_Cfg) ->
- Foo = foo,
- Bar = bar,
- Baz = baz,
- {some, Foo} = hope_option:of_undefined(Foo),
- {some, Bar} = hope_option:of_undefined(Bar),
- {some, Baz} = hope_option:of_undefined(Baz),
- none = hope_option:of_undefined(undefined).
+t_undefined(_Cfg) ->
+ X = foo,
+ {some, X} = hope_option:of_undefined(X),
+ X = hope_option:to_undefined({some, X}),
+ none = hope_option:of_undefined(undefined),
+ undefined = hope_option:to_undefined(none).
t_validate(_Cfg) ->
IsFoo = fun (X) -> X =:= foo end,