[test] Improve match macro

This commit is contained in:
Paweł Chmielowski 2018-09-14 20:27:59 +02:00
parent 410ac9b966
commit d4579d2a20
2 changed files with 6 additions and 6 deletions

View File

@ -471,9 +471,7 @@ wait_auth_SASL_result(Config, ShouldFail) ->
NS = if Type == client -> ?NS_CLIENT; NS = if Type == client -> ?NS_CLIENT;
Type == server -> ?NS_SERVER Type == server -> ?NS_SERVER
end, end,
Config2 = receive #stream_start{id = ID, xmlns = NS, version = {1,0}} -> receive #stream_start{xmlns = NS, version = {1,0}} -> ok end,
set_opt(stream_id, ID, Config)
end,
receive #stream_features{sub_els = Fs} -> receive #stream_features{sub_els = Fs} ->
if Type == client -> if Type == client ->
#xmpp_session{optional = true} = #xmpp_session{optional = true} =
@ -490,7 +488,7 @@ wait_auth_SASL_result(Config, ShouldFail) ->
set_opt(rosterver, true, ConfigAcc); set_opt(rosterver, true, ConfigAcc);
(_, ConfigAcc) -> (_, ConfigAcc) ->
ConfigAcc ConfigAcc
end, Config2, Fs) end, Config, Fs)
end; end;
#sasl_challenge{text = ClientIn} -> #sasl_challenge{text = ClientIn} ->
{Response, SASL} = (?config(sasl, Config))(ClientIn), {Response, SASL} = (?config(sasl, Config))(ClientIn),

View File

@ -66,12 +66,14 @@
end)()). end)()).
-define(match(Pattern, Result), -define(match(Pattern, Result),
(fun() ->
case Result of case Result of
Pattern -> Pattern ->
Pattern; ok;
Mismatch -> Mismatch ->
suite:match_failure([Mismatch], [??Pattern]) suite:match_failure([Mismatch], [??Pattern])
end). end
end)()).
-define(COMMON_VHOST, <<"localhost">>). -define(COMMON_VHOST, <<"localhost">>).
-define(MNESIA_VHOST, <<"mnesia.localhost">>). -define(MNESIA_VHOST, <<"mnesia.localhost">>).