<commit_before>-module(regressions_SUITE).
-compile(export_all).

-include_lib("escalus/include/escalus.hrl").
-include_lib("common_test/include/ct.hrl").
-include_lib("eunit/include/eunit.hrl").
-define(a(Condition), ?assert(Condition)).
-define(eq(A, B), ?assertEqual(A, B)).

-import(escalus_story, [story/3]).

all() ->
    [catch_timeout_when_waiting_for_stanza,
     catch_escalus_compat_bin_badarg].

suite() ->
    escalus:suite().

%%--------------------------------------------------------------------
%% Init & teardown
%%--------------------------------------------------------------------

init_per_suite(Config) ->
    escalus:init_per_suite(Config).

end_per_suite(Config) ->
    escalus:end_per_suite(Config).

init_per_testcase(CaseName, Config) ->
    escalus:init_per_testcase(CaseName, Config).

end_per_testcase(CaseName, Config) ->
    escalus:end_per_testcase(CaseName, Config).

%%--------------------------------------------------------------------
%% Tests
%%--------------------------------------------------------------------

catch_timeout_when_waiting_for_stanza(Config) ->
    story(Config, [{alice,1}],
          fun (Alice) ->
                  {'EXIT', ErrorReason} = (catch escalus:wait_for_stanza(Alice)),
                  ?a(is_2_tuple(ErrorReason)),
                  ?eq(timeout_when_waiting_for_stanza, element(1, ErrorReason))
          end).

catch_escalus_compat_bin_badarg(_) ->
    {'EXIT', ErrorReason} = (catch escalus_compat:bin({ala, <<"ma">>, {k,o,t,a}})),
    ?a(is_2_tuple(ErrorReason)),
    ?eq(badarg, element(1, ErrorReason)).

is_2_tuple(T) when is_tuple(T), tuple_size(T) == 2 -> true;
is_2_tuple(_)                                      -> false.<commit_msg>Delimit tests from helpers<commit_after>-module(regressions_SUITE).
-compile(export_all).

-include_lib("escalus/include/escalus.hrl").
-include_lib("common_test/include/ct.hrl").
-include_lib("eunit/include/eunit.hrl").
-define(a(Condition), ?assert(Condition)).
-define(eq(A, B), ?assertEqual(A, B)).

-import(escalus_story, [story/3]).

all() ->
    [catch_timeout_when_waiting_for_stanza,
     catch_escalus_compat_bin_badarg].

suite() ->
    escalus:suite().

%%--------------------------------------------------------------------
%% Init & teardown
%%--------------------------------------------------------------------

init_per_suite(Config) ->
    escalus:init_per_suite(Config).

end_per_suite(Config) ->
    escalus:end_per_suite(Config).

init_per_testcase(CaseName, Config) ->
    escalus:init_per_testcase(CaseName, Config).

end_per_testcase(CaseName, Config) ->
    escalus:end_per_testcase(CaseName, Config).

%%--------------------------------------------------------------------
%% Tests
%%--------------------------------------------------------------------

catch_timeout_when_waiting_for_stanza(Config) ->
    story(Config, [{alice,1}],
          fun (Alice) ->
                  {'EXIT', ErrorReason} = (catch escalus:wait_for_stanza(Alice)),
                  ?a(is_2_tuple(ErrorReason)),
                  ?eq(timeout_when_waiting_for_stanza, element(1, ErrorReason))
          end).

catch_escalus_compat_bin_badarg(_) ->
    {'EXIT', ErrorReason} = (catch escalus_compat:bin({ala, <<"ma">>, {k,o,t,a}})),
    ?a(is_2_tuple(ErrorReason)),
    ?eq(badarg, element(1, ErrorReason)).

%%--------------------------------------------------------------------
%% Helpers
%%--------------------------------------------------------------------

is_2_tuple(T) when is_tuple(T), tuple_size(T) == 2 -> true;
is_2_tuple(_)                                      -> false.
{'fraction_non_alphanumeric': 0.32286746318421783, 'fraction_numerical': 0.005001389274798555, 'mean_word_length': 1.7885360185902401, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 29, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7457007', 'n_tokens_mistral': 1104, 'n_tokens_neox': 1103, 'n_words': 135}