Skip to content

Commit

Permalink
Skip test of maybe expr/map compr if not supported by OTP version
Browse files Browse the repository at this point in the history
  • Loading branch information
gomoripeti committed Dec 21, 2023
1 parent af61c4a commit 9a141fa
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion apps/els_lsp/test/els_parser_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
-export([
all/0,
init_per_suite/1,
end_per_suite/1
end_per_suite/1,
init_per_testcase/2
]).

%% Test cases
Expand Down Expand Up @@ -33,6 +34,7 @@
record_def_recursive/1,
var_in_application/1,
comprehensions/1,
map_comprehensions/1,
maybe_expr/1,
unicode_clause_pattern/1,
latin1_source_code/1,
Expand Down Expand Up @@ -62,6 +64,23 @@ end_per_suite(_Config) -> ok.
-spec all() -> [atom()].
all() -> els_test_utils:all(?MODULE).

init_per_testcase(map_comprehensions, Config) ->
case list_to_integer(erlang:system_info(otp_release)) < 26 of
true ->
{skip, "Map comprehensions are only supported from OTP 26"};
false ->
Config
end;
init_per_testcase(maybe_expr, Config) ->
case list_to_integer(erlang:system_info(otp_release)) < 25 of
true ->
{skip, "Maybe expressions are only supported from OTP 25"};
false ->
Config
end;
init_per_testcase(_, Config) ->
Config.

%%==============================================================================
%% Testcases
%%==============================================================================
Expand Down Expand Up @@ -456,7 +475,9 @@ comprehensions(_Config) ->
[#{id := 'Y'}, #{id := 'X'}, #{id := 'X'}, #{id := 'Y'}, #{id := 'B'}],
parse_find_pois(Text2, variable)
),
ok.

map_comprehensions(_Config) ->
Text3 = "#{ Y => X || X := Y <- M }",
?assertMatch(
[#{id := 'Y'}, #{id := 'X'}, #{id := 'X'}, #{id := 'Y'}, #{id := 'M'}],
Expand Down

0 comments on commit 9a141fa

Please sign in to comment.