-
Notifications
You must be signed in to change notification settings - Fork 119
/
Copy pathfile_coverage.Rd
45 lines (39 loc) · 1.37 KB
/
file_coverage.Rd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/covr.R
\name{file_coverage}
\alias{file_coverage}
\title{Calculate test coverage for sets of files}
\usage{
file_coverage(
source_files,
test_files,
line_exclusions = NULL,
function_exclusions = NULL,
parent_env = parent.frame()
)
}
\arguments{
\item{source_files}{Character vector of source files with function
definitions to measure coverage}
\item{test_files}{Character vector of test files with code to test the
functions}
\item{line_exclusions}{a named list of files with the lines to exclude from
each file.}
\item{function_exclusions}{a vector of regular expressions matching function
names to exclude. Example \verb{print\\\\\\.} to match print methods.}
\item{parent_env}{The parent environment to use when sourcing the files.}
}
\description{
The files in \code{source_files} are first sourced into a new environment
to define functions to be checked. Then they are instrumented to track
coverage and the files in \code{test_files} are sourced.
}
\examples{
# For the purpose of this example, save code containing code and tests to files
cat("add <- function(x, y) { x + y }", file="add.R")
cat("add(1, 2) == 3", file="add_test.R")
# Use file_coverage() to calculate test coverage
file_coverage(source_files = "add.R", test_files = "add_test.R")
# cleanup
file.remove(c("add.R", "add_test.R"))
}