powered by
Calculate test coverage for a specific function.
function_coverage(fun, code = NULL, env = NULL, enc = parent.frame())
name of the function.
expressions to run.
environment the function is defined in.
the enclosing environment which to run the expressions.
add <- function(x, y) { x + y } function_coverage(fun = add, code = NULL) # 0% coverage function_coverage(fun = add, code = add(1, 2) == 3) # 100% coverage
Run the code above in your browser using DataLab