Skip to content

Commit

Permalink
Conditionally run maybe tests
Browse files Browse the repository at this point in the history
Runtimes that don't even have the option, don't support the ?= operator
  • Loading branch information
michalmuskala committed Nov 8, 2023
1 parent 442f056 commit 822fe72
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion test/erlfmt_format_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,8 @@ suite() ->
[{timetrap, {seconds, 10}}].

init_per_suite(Config) ->
Config.
Features = get_features(),
[{features, Features} | Config].

end_per_suite(_Config) ->
ok.
Expand All @@ -88,6 +89,11 @@ init_per_group(_GroupName, Config) ->
end_per_group(_GroupName, _Config) ->
ok.

init_per_testcase(maybe_expression, Config) ->
case has_feature(maybe_expr, Config) of
true -> Config;
false -> {skip, "Maybe feature not present in the runtime system"}
end;
init_per_testcase(_TestCase, Config) ->
Config.

Expand Down Expand Up @@ -161,6 +167,15 @@ all() ->
comment
].

get_features() ->
case erlang:function_exported(erl_features, all, 0) of
true -> erl_features:all();
false -> []
end.

has_feature(Feature, Config) ->
lists:member(Feature, proplists:get_value(features, Config)).

%%--------------------------------------------------------------------
%% TEST CASES
-define(assertSame(String), ?assertSame(String, 80)).
Expand Down

0 comments on commit 822fe72

Please sign in to comment.