X-Git-Url: https://git.xandkar.net/?p=hope.git;a=blobdiff_plain;f=test%2Fhope_option_SUITE.erl;h=af1e12e44d32eb8dbb2bee9ff32bdd7c994654b6;hp=370cf24daeb5ac4fbe19a7439509fed525324eef;hb=352ddeb475ab48aabfab59558827e0e8d927551f;hpb=cb14ad76f3cc386bce964e822733e5cb9e011ed8 diff --git a/test/hope_option_SUITE.erl b/test/hope_option_SUITE.erl index 370cf24..af1e12e 100644 --- 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_validate/1 ]). @@ -38,6 +39,7 @@ groups() -> , t_map , t_iter , t_pipe + , t_validate ], Properties = [parallel], [ {?GROUP, Properties, Tests} @@ -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). + +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).