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 for additional test code via package_coverage(..., code = .) #481

Merged
merged 3 commits into from
Aug 24, 2022

Conversation

bastistician
Copy link
Contributor

package_coverage(..., code = character()) allows for additional test code to be run. The code argument should be a character vector of lines of code. This currently fails for length(code) > 1 as this vector is cat to a test script using sep="", so arrives all in a single line.

A possible fix is attached, also including a test case.
Running this test with current covr before the patch results in the following failure:

── Error (Line 2): package_coverage runs additional test code ─────────────────────
Error: Failure in `/tmp/RtmpTBAKz9/R_LIBS7b74718d8a6a/TestS4-commands.Rout.fail`

R version 4.1.0 (2021-05-18) -- "Camp Pontanezen"
Copyright (C) 2021 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

  Natural language support but running in an English locale

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library('TestS4')
> a(1)a(2)
Error: unexpected symbol in "a(1)a"
Execution halted
Backtrace:
 1. covr::package_coverage(...)
 5. covr:::run_commands(pkg, install_path, code)
 6. covr:::show_failures(dirname(failfile))

@CLAassistant
Copy link

CLAassistant commented Jun 18, 2021

CLA assistant check
All committers have signed the CLA.

@jimhester
Copy link
Member

Sorry for the delay in reviewing this, I think what you did looks good, thanks!

Can you please add a bullet to NEWS? It should briefly describe the change and end with (@yourname, #issuenumber).

@jimhester jimhester merged commit 16a349a into r-lib:main Aug 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants