Fix 1074 to improve code coverage of R/utils.R
to 100%
#1075
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fix #1074
Testing strategy:
Some interactive code inside
R/utils.R
is tested using{mockery}
which is not part of{golem}
so this is experimental. However, it is the recommended way to go wheninteractive()
code parts should be tested (as far as I understood), hence the approach (and the implied request to add{mockery}
toSuggests
, which also is used here Fix 887 and improve code coverage ofR/config.R
from 28.21% to 100% #1043).CLI messaging is tested via snapping the output which has the benefit that whenever the underlying
{cli}
package changes output style one gets automatic notifications making devs aware of the fact that screen output changes.PR parts in detail:
Done
The following a "rather" independent so commits can be cherry picked:
d0feaf5: some minor additions to
is_existing_module()
with cleaner testing (to actually delete redundant artefact dirs on exit)8ed4ccf: add tests for non-interactive part of
create_if_needed()
function:move coverage to 58.58 %
cea07f2: add tests for interactive part of
create_if_needed()
function mimicking user behavior: "no"/FALSE
:move coverage to 60.09 %
de07bb3: add tests for interactive part of
create_if_needed()
function mimicking user behavior: "yes"/TRUE
:move coverage to 62.62 %
9025d9f: shallow test encapsulated
ask_golem_creation_file()
AND remove never used functioncheck_file_exist()
; I could not find any call to this function inside golem and it is unexported as well....move coverage to 67.79%
fcd73a7: snapshot test cli messages
move coverage to 88.98 %
To-Do