-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,
+ none = hope_option:validate(none, IsFoo),
+ none = hope_option:validate({some, bar}, IsFoo),
+ {some, foo} = hope_option:validate({some, foo}, IsFoo).