File: test_file.Rd

package info (click to toggle)
r-cran-testthat 3.2.3-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 3,452 kB
  • sloc: cpp: 9,261; ansic: 37; sh: 14; makefile: 5
file content (51 lines) | stat: -rw-r--r-- 1,464 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/test-files.R
\name{test_file}
\alias{test_file}
\title{Run tests in a single file}
\usage{
test_file(
  path,
  reporter = default_compact_reporter(),
  desc = NULL,
  package = NULL,
  ...
)
}
\arguments{
\item{path}{Path to file.}

\item{reporter}{Reporter to use to summarise output. Can be supplied
as a string (e.g. "summary") or as an R6 object
(e.g. \code{SummaryReporter$new()}).

See \link{Reporter} for more details and a list of built-in reporters.}

\item{desc}{Optionally, supply a string here to run only a single
test (\code{test_that()} or \code{describe()}) with this \code{desc}ription.}

\item{package}{If these tests belong to a package, the name of the package.}

\item{...}{Additional parameters passed on to \code{test_dir()}}
}
\value{
A list (invisibly) containing data about the test results.
}
\description{
Helper, setup, and teardown files located in the same directory as the
test will also be run. See \code{vignette("special-files")} for details.
}
\section{Environments}{

Each test is run in a clean environment to keep tests as isolated as
possible. For package tests, that environment inherits from the package's
namespace environment, so that tests can access internal functions
and objects.
}

\examples{
path <- testthat_example("success")
test_file(path)
test_file(path, desc = "some tests have warnings")
test_file(path, reporter = "minimal")
}