added error message matching for fail tests

This commit is contained in:
Korry Clark 2016-10-24 21:17:43 -07:00
parent ffedf60096
commit 333bc02bf4

View File

@ -76,6 +76,7 @@
-define(FAIL_TESTS, [ -define(FAIL_TESTS, [
{ {
{1001,<<"The upper and lower boundaries are equal or adjacent. No results are possible.">>},
{">", "2016-08-02 10:19"}, {">", "2016-08-02 10:19"},
{"<", "2016-08-02 10:20"} {"<", "2016-08-02 10:20"}
} }
@ -112,14 +113,14 @@ confirm() ->
end, ?PASS_TESTS), end, ?PASS_TESTS),
lists:foreach( lists:foreach(
fun({{Op1, String1}, {Op2, String2}}) -> fun({{ErrCode, ErrMsg}, {Op1, String1}, {Op2, String2}}) ->
Qry = lists:flatten( Qry = lists:flatten(
io_lib:format(QryFmt, [Op1, String1, io_lib:format(QryFmt, [Op1, String1,
Op2, String2])), Op2, String2])),
RetMsg = ts_util:single_query(Conn, Qry), RetMsg = ts_util:single_query(Conn, Qry),
%% Assert that RetMsg returns a tuple with error in first place {error, {}} ExpectMsg = {error, {ErrCode, ErrMsg}},
?assertMatch({error, {_ErrCode, _ErrMsg}}, RetMsg) ?assertMatch(ExpectMsg, RetMsg)
end, ?FAIL_TESTS), end, ?FAIL_TESTS),
pass. pass.