Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:Ledest:erlang:26
erlang
2367-Fix-error-information-for-code-get_coverag...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 2367-Fix-error-information-for-code-get_coverage-2.patch of Package erlang
From 49288c0ab921905d518e02272b6ce17f2b1ceaa1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Gustavsson?= <bjorn@erlang.org> Date: Fri, 16 Aug 2024 09:20:25 +0200 Subject: [PATCH] Fix error information for `code:get_coverage/2` If `code:get_coverage(cover_line_id, Module)` failed, the first argument would be unjustly blamed for the failure, instead of the second argument ("the atom does not refer to a loaded module" or "not loaded with coverage enabled"). --- lib/kernel/src/erl_kernel_errors.erl | 5 ++++- lib/kernel/test/code_coverage_SUITE.erl | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/kernel/src/erl_kernel_errors.erl b/lib/kernel/src/erl_kernel_errors.erl index bd6c7acf58..59a55b8590 100644 --- a/lib/kernel/src/erl_kernel_errors.erl +++ b/lib/kernel/src/erl_kernel_errors.erl @@ -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 [] -> @@ -367,6 +368,8 @@ expand_error(bad_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) -> diff --git a/lib/kernel/test/code_coverage_SUITE.erl b/lib/kernel/test/code_coverage_SUITE.erl index 0a79812c77..0ccdb57c9b 100644 --- a/lib/kernel/test/code_coverage_SUITE.erl +++ b/lib/kernel/test/code_coverage_SUITE.erl @@ -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]}, -- 2.43.0
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor