source_file: Source a file, directory of files, or various important...

View source: R/source.R

source_fileR Documentation

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,
  desc = NULL,
  wrap = TRUE,
  error_call = caller_env()
)

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)?

desc

If not-NULL, will run only test with this description.

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.


r-lib/testthat documentation built on Feb. 18, 2024, 8:59 p.m.