cov <- withr::with_options(
list(covr.record_tests = TRUE),
code_coverage(
"f <- function(x) {\n if (x) 'yes' else 'no'\n}",
"f(TRUE)\nf(FALSE)"
)
)
tests <- tally_tests(cov)
tests
# The tests that ran lines 1 to 2
unique(tests[tests$line %in% 1:2, c("test_file", "test_line")])
Run the code above in your browser using DataLab