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

Fix error information for code:get_coverage/2 #8728

Merged
merged 1 commit into from
Aug 19, 2024
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
5 changes: 4 additions & 1 deletion lib/kernel/src/erl_kernel_errors.erl
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ format_code_error(get_coverage, [What,Module]) ->
Error = case What of
function -> [];
line -> [];
_ -> <<"must be one of: function or line">>
cover_line_id -> [];
_ -> coverage_level
end,
case Error of
[] ->
Expand Down Expand Up @@ -367,6 +368,8 @@ expand_error(bad_tracer) ->
<<"invalid tracer">>;
expand_error(coverage_disabled) ->
<<"not loaded with coverage enabled">>;
expand_error(coverage_level) ->
<<"must be one of: function, line, or cover_line_id">>;
expand_error(eq_in_list) ->
<<"\"=\" characters is not allowed in environment variable names">>;
expand_error(zero_in_list) ->
Expand Down
1 change: 1 addition & 0 deletions lib/kernel/test/code_coverage_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,7 @@ error_info(_Config) ->
{get_coverage, [line,42]},
{get_coverage, [line,NotLoaded]},
{get_coverage, [line,?MODULE]},
{get_coverage, [cover_line_id,NotLoaded]},
{get_coverage, [whatever,?MODULE]},

{reset_coverage, [42]},
Expand Down
Loading