file_coverage_runit: Extends the [covr::file_coverage()] function to also accept...

Description Usage Arguments Value Examples

View source: R/file_coverage_runit.R

Description

Extends the [covr::file_coverage()] function to also accept test files based on RUnit

Usage

1
2
3
file_coverage_runit(source_files, test_files, load_package = FALSE,
  testFileRegexp = "^test.+\\\\.R", testFuncRegexp = "^test.+",
  unlink_tmp_dir = FALSE, ...)

Arguments

source_files

Character vector of pathes to source files with function definitions to measure coverage

test_files

Character vector of pathes to test files with code to test the functions

load_package

Boolean. If TRUE all source_files need to be located within the directory of the same package. Set TRUE if your source_files depend on other functions from your package.

testFileRegexp

Regular expression for matching test files. See [covr::runTestSuite()].

testFuncRegexp

Regular expression for matching test functions. See [covr::runTestSuite()].

unlink_tmp_dir

Boolean. When running [filecovrunit::package_coverage()] a package is created in R's temp directory. If TRUE the directory where the temporary pacakge is stored is unlinked after each function call. If FALSE the directory is only deleted when you quit your R-session. Note: When the temp package directory is deleted [filecovrunit::zero_coverage()] does not work anymore!

...

Additional arguments passed to [covr::package_coverage()]

Value

an covr object (identital to [covr::package_coverage()])

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
# load test data
src <- c(system.file(file.path("extdata", "functions.R"), package = "filecovrunit"),
system.file(file.path("extdata", "functions2.R"), package = "filecovrunit"))
test <- c(system.file(file.path("extdata", "test_1.R"), package = "filecovrunit"),
system.file(file.path("extdata", "test_2.R"), package = "filecovrunit"))

# check file coverage of the files
cov <- filecovrunit::file_coverage_runit(source_files = src,
test_files = test,
load_package = FALSE)
cov
covr::report(cov)
filecovrunit::zero_coverage(cov)

simonpedrobolivar/filecovRunit documentation built on May 28, 2019, 5:41 a.m.