Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Un-break katana for projects that do not enable maybe_expr #76

Merged
merged 1 commit into from
Mar 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ jobs:

build:

runs-on: ubuntu-latest
runs-on: ubuntu-20.04

strategy:
matrix:
Expand Down Expand Up @@ -34,6 +34,8 @@ jobs:
run: ERL_FLAGS="-enable-feature all" rebar3 compile
- name: Format check
run: ERL_FLAGS="-enable-feature all" rebar3 format --verify
- name: Run tests and verifications
- name: Run tests and verifications (features not enabled)
run: rebar3 test
- name: Run tests and verifications (features enabled)
run: ERL_FLAGS="-enable-feature all" rebar3 test

8 changes: 1 addition & 7 deletions rebar.config
Original file line number Diff line number Diff line change
@@ -1,13 +1,7 @@
%% -*- mode: erlang;erlang-indent-level: 2;indent-tabs-mode: nil -*-
%% ex: ts=4 sw=4 ft=erlang et
{erl_opts,
[warn_unused_import,
warn_export_vars,
warnings_as_errors,
verbose,
report,
debug_info,
{feature, maybe_expr, enable}]}.
[warn_unused_import, warn_export_vars, warnings_as_errors, verbose, report, debug_info]}.

{minimum_otp_vsn, "23"}.

Expand Down
19 changes: 18 additions & 1 deletion test/ktn_code_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,16 @@
-spec all() -> [atom()].
all() ->
Exports = ?MODULE:module_info(exports),
[F || {F, _} <- Exports, not lists:member(F, ?EXCLUDED_FUNS)].
%% Do not test maybe expressions if the feature is not enabled in the emulator
DisabledMaybeTests =
case lists:member(maybe_expr, enabled_features()) of
true ->
[];
false ->
[parse_maybe, parse_maybe_else]
end,
Excluded = ?EXCLUDED_FUNS ++ DisabledMaybeTests,
[F || {F, _} <- Exports, not lists:member(F, Excluded)].

-spec init_per_suite(config()) -> config().
init_per_suite(Config) ->
Expand All @@ -33,6 +42,14 @@ init_per_suite(Config) ->
end_per_suite(Config) ->
Config.

enabled_features() ->
try
elbrujohalcon marked this conversation as resolved.
Show resolved Hide resolved
erl_features:enabled()
catch
error:undef ->
[]
end.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Test Cases
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Expand Down