Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
plux committed Apr 24, 2024
1 parent 17284ab commit 4eb14e3
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 70 deletions.
6 changes: 1 addition & 5 deletions apps/els_lsp/src/els_document_highlight_provider.erl
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,8 @@ valid_highlight_pois(Document, Line, Character) ->
P
|| #{kind := Kind} = P <- POIs,
Kind /= keyword_expr,
Kind /= spec,
Kind /= module,
Kind /= function_clause,
Kind /= function,
Kind /= define,
Kind /= callback
Kind /= function_clause
].

%%==============================================================================
Expand Down
122 changes: 57 additions & 65 deletions apps/els_lsp/test/els_code_action_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -166,25 +166,23 @@ suggest_variable(Config) ->
},
#{result := Result} = els_client:document_codeaction(Uri, Range, [Diag]),
Expected =
[
#{
edit => #{
#{
edit => #{
changes =>
#{
binary_to_atom(Uri, utf8) =>
[
#{
range => Range,
newText => <<"Bar">>
}
]
}
},
kind => <<"quickfix">>,
title => <<"Did you mean 'Bar'?">>
}
],
?assertEqual(Expected, Result),
binary_to_atom(Uri, utf8) =>
[
#{
range => Range,
newText => <<"Bar">>
}
]
}
},
kind => <<"quickfix">>,
title => <<"Did you mean 'Bar'?">>
},
?assert(lists:member(Expected, Result)),
ok.

-spec fix_module_name(config()) -> ok.
Expand Down Expand Up @@ -325,30 +323,28 @@ create_undefined_function(Config) ->
},
#{result := Result} = els_client:document_codeaction(Uri, Range, [Diag]),
Expected =
[
#{
edit => #{
#{
edit => #{
changes =>
#{
binary_to_atom(Uri, utf8) =>
[
#{
range =>
els_protocol:range(#{
from => {28, 1},
to => {28, 1}
}),
newText =>
<<"foobar() ->\n ok.\n\n">>
}
]
}
},
kind => <<"quickfix">>,
title => <<"Create function foobar/0">>
}
],
?assertEqual(Expected, Result),
binary_to_atom(Uri, utf8) =>
[
#{
range =>
els_protocol:range(#{
from => {28, 1},
to => {28, 1}
}),
newText =>
<<"foobar() ->\n ok.\n\n">>
}
]
}
},
kind => <<"quickfix">>,
title => <<"Create function foobar/0">>
},
?assert(lists:member(Expected, Result)),
ok.

-spec create_undefined_function_arity((config())) -> ok.
Expand All @@ -366,30 +362,28 @@ create_undefined_function_arity(Config) ->
},
#{result := Result} = els_client:document_codeaction(Uri, Range, [Diag]),
Expected =
[
#{
edit => #{
#{
edit => #{
changes =>
#{
binary_to_atom(Uri, utf8) =>
[
#{
range =>
els_protocol:range(#{
from => {28, 1},
to => {28, 1}
}),
newText =>
<<"foobar(Arg1, Arg2, Arg3) ->\n ok.\n\n">>
}
]
}
},
kind => <<"quickfix">>,
title => <<"Create function foobar/3">>
}
],
?assertEqual(Expected, Result),
binary_to_atom(Uri, utf8) =>
[
#{
range =>
els_protocol:range(#{
from => {28, 1},
to => {28, 1}
}),
newText =>
<<"foobar(Arg1, Arg2, Arg3) ->\n ok.\n\n">>
}
]
}
},
kind => <<"quickfix">>,
title => <<"Create function foobar/3">>
},
?assert(lists:member(Expected, Result)),
ok.

-spec create_undefined_function_variable_names((config())) -> ok.
Expand All @@ -407,7 +401,6 @@ create_undefined_function_variable_names(Config) ->
},
#{result := Result} = els_client:document_codeaction(Uri, Range, [Diag]),
Expected =
[
#{
edit => #{
changes =>
Expand All @@ -428,9 +421,8 @@ create_undefined_function_variable_names(Config) ->
},
kind => <<"quickfix">>,
title => <<"Create function foobar/5">>
}
],
?assertEqual(Expected, Result),
},
?assert(lists:member(Expected, Result)),
ok.

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

0 comments on commit 4eb14e3

Please sign in to comment.