X-Git-Url: https://git.xandkar.net/?p=hope.git;a=blobdiff_plain;f=test%2Fhope_option_SUITE.erl;h=8789d3d8e021fba5569b8552a87f6ad36a399534;hp=2b3dab0005f073efe0d165270a2ca56b3b688281;hb=4af0774b16181c76d0deedf0911d53409c8f1078;hpb=2dc71691ff8d7494f80a2af26994c186779d6898 diff --git a/test/hope_option_SUITE.erl b/test/hope_option_SUITE.erl index 2b3dab0..8789d3d 100644 --- a/test/hope_option_SUITE.erl +++ b/test/hope_option_SUITE.erl @@ -13,6 +13,7 @@ , t_get/1 , t_map/1 , t_iter/1 + , t_pipe/1 ]). @@ -34,6 +35,7 @@ groups() -> , t_get , t_map , t_iter + , t_pipe ], Properties = [parallel], [ {?GROUP, Properties, Tests} @@ -75,3 +77,14 @@ t_of_result(_Cfg) -> ResultError = {error, Bar}, {some, Foo} = hope_option:of_result(ResultOk), none = hope_option:of_result(ResultError). + +t_pipe(_Cfg) -> + Steps = + [ fun (0) -> hope_option:return(1); (_) -> none end + , fun (1) -> hope_option:return(2); (_) -> none end + , fun (2) -> hope_option:return(3); (_) -> none end + ], + {some, 3} = hope_option:pipe(Steps, 0), + none = hope_option:pipe(Steps, 1), + none = hope_option:pipe(Steps, 2), + none = hope_option:pipe(Steps, 3).