powered by
This function is useful for testing, and is a thin wrapper around file_coverage() because parseData is not populated properly unless the functions are defined in a file.
file_coverage()
code_coverage( source_code, test_code, line_exclusions = NULL, function_exclusions = NULL, ... )
A character vector of source code
A character vector of test code
a named list of files with the lines to exclude from each file.
a vector of regular expressions matching function names to exclude. Example print\\\. to match print methods.
print\\\.
Additional arguments passed to file_coverage()
source <- "add <- function(x, y) { x + y }" test <- "add(1, 2) == 3" code_coverage(source, test)
Run the code above in your browser using DataLab