Learn R Programming

testextra (version 0.1.0.1)

covr-single: Single File Coverage

Description

These functions extract tests, run tests and create a report of the coverage for a single file.

Usage

file_coverage(file = rstudioapi::getSourceEditorContext()$path,
  pkg = ".", ...)

covr_file(coverage = file_coverage(), report.file = NULL, show.report = interactive())

Arguments

file

The file to extract test from and compute coverage.

pkg

The package file is associated with.

...

Arguments passed on to covr::file_coverage

source_files

Character vector of source files with function definitions to measure coverage

test_files

Character vector of test files with code to test the functions

line_exclusions

a named list of files with the lines to exclude from each file.

function_exclusions

a vector of regular expressions matching function names to exclude. Example print\\. to match print methods.

parent_env

The parent environment to use when sourcing the files.

coverage

Coverage returned from file_coverage().

report.file

Where to save the HTML report.

show.report

if the HTML report should be displayed.

Functions

  • file_coverage: Extract tests and compute the coverage for the given file.

  • covr_file: Create a report for a single