Skip to content

Commit

Permalink
fixup! kernel: Fix code:get_doc/1,2 when cover_compiled
Browse files Browse the repository at this point in the history
  • Loading branch information
bjorng committed Feb 25, 2025
1 parent d51a975 commit 4a5efd6
Showing 1 changed file with 23 additions and 13 deletions.
36 changes: 23 additions & 13 deletions lib/compiler/test/beam_doc_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@
-define(get_name(), atom_to_list(?FUNCTION_NAME)).

all() ->
[{group, documentation_generation_tests}, doc_with_file].
[{group, documentation_generation_tests},
doc_with_file,
cover_compiled].

groups() ->
[{documentation_generation_tests, [parallel], documentation_generation_tests()}].
Expand Down Expand Up @@ -56,8 +58,7 @@ documentation_generation_tests() ->
skip_doc,
no_doc_attributes,
converted_metadata,
converted_metadata_warnings,
cover_compiled
converted_metadata_warnings
].

singleton_moduledoc(Conf) ->
Expand Down Expand Up @@ -697,16 +698,25 @@ converted_metadata_warnings(Config) ->
ok.

cover_compiled(Config) ->
DataDir = proplists:get_value(data_dir, Config),
ok = file:set_cwd(DataDir),

ModuleName = ?get_name(),
{ok, ModName} = default_compile_file(Config, ModuleName),
{ok, cover_compiled} = cover:compile(ModuleName),

{ok, #docs_v1{}} = code:get_doc(ModName),

ok.
case test_server:is_cover() of
true ->
{skip, "Cover is running"};
false ->
try
DataDir = proplists:get_value(data_dir, Config),
ok = file:set_cwd(DataDir),

ModuleName = ?get_name(),
{ok, ModName} = default_compile_file(Config, ModuleName),
{ok, cover_compiled} = cover:compile(ModuleName),

{ok, #docs_v1{}} = code:get_doc(ModName),

ok
after
cover:stop()
end
end.

scan_and_parse(Code) ->
{ok, Toks, _} = erl_scan:string(Code),
Expand Down

0 comments on commit 4a5efd6

Please sign in to comment.