Skip to content

Commit

Permalink
els_diagnostic_SUITE:bound_var_in_pattern/1 update
Browse files Browse the repository at this point in the history
  • Loading branch information
MarkoMin committed Sep 13, 2024
1 parent af031a6 commit eb7bab4
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
-feature(maybe_expr, enable).
-endif.

-export([foo/0]).
-export([foo/0, maybe_expr/0]).

foo() ->
maybe
Expand All @@ -18,3 +18,12 @@ foo() ->

bar() ->
foo.

maybe_expr() ->
X = 1,
Y = ok,
maybe
X ?= 1
else
Y -> Y
end.
15 changes: 13 additions & 2 deletions apps/els_lsp/test/els_diagnostics_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,9 @@ init_per_testcase(TestCase, Config) when
{skip, "Maybe expressions are only supported from OTP 25"};
false ->
Config
end;
end,
els_mock_diagnostics:setup(),
els_test_utils:init_per_testcase(TestCase, Config);
init_per_testcase(TestCase, Config) ->
els_mock_diagnostics:setup(),
els_test_utils:init_per_testcase(TestCase, Config).
Expand Down Expand Up @@ -380,7 +382,16 @@ bound_var_in_pattern_maybe(_Config) ->
Source = <<"BoundVarInPattern">>,
Errors = [],
Warnings = [],
Hints = [],
Hints = [
#{
message => <<"Bound variable in pattern: X">>,
range => {{24, 9}, {24, 10}}
},
#{
message => <<"Bound variable in pattern: Y">>,
range => {{27, 9}, {27, 10}}
}
],
els_test:run_diagnostics_test(Path, Source, Errors, Warnings, Hints).

-spec bound_var_in_pattern_cannot_parse(config()) -> ok.
Expand Down

0 comments on commit eb7bab4

Please sign in to comment.