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 af167dd
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,19 @@

-export([f/1, g/1, h/2, fun_expr/1, named_fun_expr/0]).

-if(?OTP_RELEASE>=25).
-export([maybe_expr/0]).

maybe_expr() ->
X = 1,
Y = ok,
maybe
X ?= 1
else
Y -> Y
end.
-endif.

f(Var1) ->
Var1 = 1.

Expand Down
26 changes: 18 additions & 8 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 @@ -333,23 +335,23 @@ bound_var_in_pattern(_Config) ->
Hints0 = [
#{
message => <<"Bound variable in pattern: Var1">>,
range => {{5, 2}, {5, 6}}
range => {{18, 2}, {18, 6}}
},
#{
message => <<"Bound variable in pattern: Var2">>,
range => {{9, 9}, {9, 13}}
range => {{22, 9}, {22, 13}}
},
#{
message => <<"Bound variable in pattern: Var4">>,
range => {{17, 8}, {17, 12}}
range => {{30, 8}, {30, 12}}
},
#{
message => <<"Bound variable in pattern: Var3">>,
range => {{15, 10}, {15, 14}}
range => {{28, 10}, {28, 14}}
},
#{
message => <<"Bound variable in pattern: Var5">>,
range => {{23, 6}, {23, 10}}
range => {{36, 6}, {36, 10}}
}
],
Hints =
Expand All @@ -362,11 +364,19 @@ bound_var_in_pattern(_Config) ->
[
#{
message => <<"Bound variable in pattern: New">>,
range => {{28, 6}, {28, 9}}
range => {{41, 6}, {41, 9}}
},
#{
message => <<"Bound variable in pattern: F">>,
range => {{29, 6}, {29, 7}}
range => {{42, 6}, {42, 7}}
},
#{
message => <<"Bound variable in pattern: X">>,
range => {{11, 9}, {11, 10}}
},
#{
message => <<"Bound variable in pattern: Y">>,
range => {{13, 9}, {13, 10}}
}
]
)
Expand Down

0 comments on commit af167dd

Please sign in to comment.