Learn R Programming

srcpkgs (version 0.2)

pkg_test: tests a package - runs its unit tests

Description

This function will test a source package using testthat, making sure the package and its source package dependencies are up-to-date and loaded

Usage

pkg_test(
  pkgid,
  filter = NULL,
  src_pkgs = get_srcpkgs(),
  export_all = TRUE,
  quiet = TRUE,
  ...
)

Value

the results as a pkg_test object, which is an empty listL if no tests were found

Arguments

pkgid

a package name, path or package object

filter

filter in the tests to run. cf testthat::test_dir()

src_pkgs

a collection of source packages as a srckgs object.

export_all

passed to pkg_load(). Enables the test functions to easily access to non-exported functions. Caveat: If the pkg is already loaded and up-to-date with export_all=FALSE, it will not work.

quiet

whether to be quiet/silent

...

passed to testthat::test_dir()

Examples

Run this code
 pkg <- setup_and_get_dummy_srcpkg()
 res <- pkg_test(pkg)
 print(res)

Run the code above in your browser using DataLab