-
Notifications
You must be signed in to change notification settings - Fork 133
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 1058, 1060, 1062 and improve code coverage in use_files.R
from 0 to 100%
#1059
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- add some dummy files to the inst/utils/ directory - for later: add tests that download exactly from that directory Refs: ThinkR-open#1058
ilyaZar
changed the title
tests: add dummy files for
Improve code coverage in Jul 5, 2023
use_{external,internal}_XXX_files()
testinguse_files.R
from 0 to 100%
- fix typo in testfile_template_html - use styler::style_file(..., style = grkstyle::grk_style_transformer)
ilyaZar
force-pushed
the
fix-1058
branch
2 times, most recently
from
July 5, 2023 11:02
71f341a
to
281de4e
Compare
- the order needs a change at some places: first set a default value when name argument is missing - only then call check_name_length() to avoid errors of the type: "argument "name" is missing, with no default" - also, to avoid RStudio and other IDEs linting a missing argument, provide a default value "NULL" for argument 'name' Refs: ThinkR-open#1060
ilyaZar
changed the title
Improve code coverage in
Fix 160 and improve code coverage in Jul 5, 2023
use_files.R
from 0 to 100%use_files.R
from 0 to 100%
ilyaZar
changed the title
Fix 160 and improve code coverage in
Fix 1060 and improve code coverage in Jul 5, 2023
use_files.R
from 0 to 100%use_files.R
from 0 to 100%
- instead of throwing an error, return 'FALSE' is passed and cat_dir_necessary() prints an informative message to the user (with the same effect i.e. not creating a directory) - this behavior is a bit more userfriendly and also allows for a code coverage of 100%; the latter is not possible to implement since tests are run non-interactively
ilyaZar
changed the title
Fix 1060 and improve code coverage in
Fix 1058, 1060, 1062 and improve code coverage in Jul 5, 2023
use_files.R
from 0 to 100%use_files.R
from 0 to 100%
This was referenced Jul 5, 2023
Closed
VincentGuyader
added a commit
that referenced
this pull request
Aug 8, 2023
* Fix 1058, 1060, 1062 and improve code coverage in `use_files.R` from 0 to 100% (#1059) * tests: add dummy files for use_{external,internal}_XXX_files() testing - add some dummy files to the inst/utils/ directory - for later: add tests that download exactly from that directory Refs: #1058 * tests: add testing for external-funcs standard cases * tests: add testing for internal-funcs standard cases - fix typo in testfile_template_html - use styler::style_file(..., style = grkstyle::grk_style_transformer) * fix: set default value for argument name before using it - the order needs a change at some places: first set a default value when name argument is missing - only then call check_name_length() to avoid errors of the type: "argument "name" is missing, with no default" - also, to avoid RStudio and other IDEs linting a missing argument, provide a default value "NULL" for argument 'name' Refs: #1060 * feat: improve error handling and allow codecovr. to be 100% - instead of throwing an error, return 'FALSE' is passed and cat_dir_necessary() prints an informative message to the user (with the same effect i.e. not creating a directory) - this behavior is a bit more userfriendly and also allows for a code coverage of 100%; the latter is not possible to implement since tests are run non-interactively * tests: add corner cases for tests to make covr. 100% * chore bump coverage --------- Co-authored-by: Ilya Zarubin <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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 #1058
Fix #1060
Fix #1062
The testing strategy is to:
inst/utils
use_external_XXX_files()
function family download these templates (from the Github repo) and compare their content to a hard-coded resultuse_internal_XXX_files()
function family copy these files internally (frominst/utils
) and compare their content to the same hard-coded resultTo-Do/ Note keeping
use_external_XXX_files()
: download these templates, check correctness viareadLines()
use_external_XXX_files()
: go through corner cases to make coverage 100% for these functionsuse_internal_XXX_files()
: copy internally these templates, check correctness viareadLines()
use_internal_XXX_files()
: go through corner cases to make coverage 100% for these functionsImportant
Eventually one needs to get rid of the links to the external files in https://github.com/ilyaZar/golem/tree/fix-1058/inst/utils . Currently these links are necessary because otherwise there is no access to the external files to check if the download works properly.
However, if this PR gets merged and the template-testing files are available (inside the branch where the merge happens), one can change the external links to point to the respective branch under the
https://github.com/ThinkR-open/golem/
repository directly.So the tests will always work from then onwards, without links to external sources. The link changes should be added via a follow up PR.