Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

source_file

Source a file, directory of files, or various important subsets


Description

These are used by test_dir() and friends

Usage

source_file(path, env = test_env(), chdir = TRUE, wrap = TRUE)

source_dir(
  path,
  pattern = "\\.[rR]$",
  env = test_env(),
  chdir = TRUE,
  wrap = TRUE
)

source_test_helpers(path = "tests/testthat", env = test_env())

source_test_setup(path = "tests/testthat", env = test_env())

source_test_teardown(path = "tests/testthat", env = test_env())

Arguments

path

Path to files.

env

Environment in which to evaluate code.

chdir

Change working directory to dirname(path)?

wrap

Automatically wrap all code within test_that()? This ensures that all expectations are reported, even if outside a test block.

pattern

Regular expression used to filter files.


testthat

Unit Testing for R

v3.0.2
MIT + file LICENSE
Authors
Hadley Wickham [aut, cre], RStudio [cph, fnd], R Core team [ctb] (Implementation of utils::recover())
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.