From: Siraaj Khandkar Date: Wed, 13 Aug 2014 02:24:28 +0000 (-0400) Subject: Add a basic sanity test for result pipe. X-Git-Tag: 1.0.0~16 X-Git-Url: https://git.xandkar.net/?a=commitdiff_plain;h=7e9d7f2cba7c91e2ae1dab489860f19bce9cbdc3;p=hope.git Add a basic sanity test for result pipe. --- diff --git a/test/hope_result_SUITE.erl b/test/hope_result_SUITE.erl new file mode 100644 index 0000000..618713d --- /dev/null +++ b/test/hope_result_SUITE.erl @@ -0,0 +1,45 @@ +-module(hope_result_SUITE). + +%% Callbacks +-export( + [ all/0 + , groups/0 + ]). + +%% Test cases +-export( + [ t_pipe/1 + ]). + + +-define(GROUP_PIPE, result_pipe). + + +%% ============================================================================ +%% Common Test callbacks +%% ============================================================================ + +all() -> + [{group, ?GROUP_PIPE}]. + +groups() -> + Tests = + [ t_pipe + ], + Properties = [], + [{?GROUP_PIPE, Properties, Tests}]. + + +%% ============================================================================= +%% Test cases +%% ============================================================================= + +t_pipe(_Config) -> + A = foo, + Z = qux, + Steps = + [ fun (foo) -> {ok, bar}; (X) -> {error, X} end + , fun (bar) -> {ok, baz}; (X) -> {error, X} end + , fun (baz) -> {ok, qux}; (X) -> {error, X} end + ], + {ok, Z} = hope_result:pipe(Steps, A).