Skip to content

Optionally make partial coverage "uncovered" #608

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

Open
wants to merge 14 commits into
base: main
Choose a base branch
from
Open
Prev Previous commit
Next Next commit
revert debugging
  • Loading branch information
MichaelChirico committed May 10, 2025
commit e21c26907752f31de6a9f523064e919324e9514a
10 changes: 5 additions & 5 deletions tests/testthat/test-Compiled.R
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ test_that("Compiled code coverage is reported including code in headers", {
skip_on_cran()
skip_if(is_win_r41())

cov <- as.data.frame(package_coverage("TestCompiled", relative_path = TRUE, quiet=FALSE))
cov <- as.data.frame(package_coverage("TestCompiled", relative_path = TRUE))

simple_cc <- cov[cov$filename == "src/simple.cc", ]
expect_equal(simple_cc[simple_cc$first_line == "10", "value"], 4)
Expand Down Expand Up @@ -31,7 +31,7 @@ test_that("Compiled code coverage is reported including code in headers", {
test_that("Can pass path to relative_path argument", {
skip_on_cran()
skip_if(is_win_r41())
cov <- as.data.frame(package_coverage("TestCompiled", relative_path = ".", quiet=FALSE))
cov <- as.data.frame(package_coverage("TestCompiled", relative_path = "."))

expect_true(all(unique(cov$filename) %in% c(
"TestCompiled/R/TestCompiled.R",
Expand Down Expand Up @@ -85,7 +85,7 @@ test_that("Warning thrown for empty gcov output", {

withr::local_options(covr.gcov_args='-n')
expect_snapshot(
. <- package_coverage("TestCompiled", relative_path=TRUE, quiet=FALSE),
. <- package_coverage("TestCompiled", relative_path=TRUE),
transform = function(x) gsub(getwd(), "<wd>", x)
)
})
Expand All @@ -94,7 +94,7 @@ test_that("tally_coverage includes compiled code", {
skip_on_cran()
skip_if(is_win_r41())

cov <- package_coverage(test_path("TestCompiled"), quiet=FALSE)
cov <- package_coverage(test_path("TestCompiled"))
tall <- tally_coverage(cov)

expect_named(tall, c("filename", "functions", "line", "value"))
Expand All @@ -109,7 +109,7 @@ test_that("Partial coverage can be optionally excluded", {
skip_if(is_win_r41())
withr::local_options(list(covr.gcov_exclude_partial_lines = TRUE))

cov <- as.data.frame(package_coverage("TestCompiled", relative_path = TRUE, quiet=FALSE))
cov <- as.data.frame(package_coverage("TestCompiled", relative_path = TRUE))

simple_cc <- cov[cov$filename == "src/simple.cc", ]
expect_equal(simple_cc[simple_cc$first_line == "34", "value"], 0)
Expand Down
Loading