Title: | What the Package Does (One Line, Title Case) |
---|---|
Description: | What the package does (one paragraph). |
Authors: | Paul Hoffman [aut, cre] |
Maintainer: | Paul Hoffman <[email protected]> |
License: | MIT + file LICENSE |
Version: | 0.0.0.9002 |
Built: | 2024-11-22 04:52:11 UTC |
Source: | https://github.com/mojaveazure/tinyexpect |
What the package does (one paragraph).
Maintainer: Paul Hoffman [email protected] (ORCID)
Expect Invisible
expect_invisible(current, ..., info = NA_character_)
expect_invisible(current, ..., info = NA_character_)
current |
|
... |
Ignored |
info |
|
A tinytest
object. A tinytest object is a
logical
with attributes holding information about the
test that was run
testthat equivalent:
testthat::expect_invisible()
withVisible()
, invisible()
Other visibility:
expect_visible()
f <- \() invisible() expect_invisible(f()) g <- \() NULL expect_invisible(g())
f <- \() invisible() expect_invisible(f()) g <- \() NULL expect_invisible(g())
Check that current
is an S3 object that
inherits from class
expect_s3_class(current, class, ..., info = NA_character_, exact = FALSE)
expect_s3_class(current, class, ..., info = NA_character_, exact = FALSE)
current |
|
class |
|
... |
Ignored |
info |
|
exact |
|
A tinytest
object. A tinytest object is a
logical
with attributes holding information about the
test that was run
testthat equivalent:
testthat::expect_s3_class()
Other inheritance:
expect_s4_class()
,
expect_type()
expect_s3_class(data.frame(), "data.frame") expect_s3_class(1L, "integer") expect_s3_class(1L, NA) if (requireNamespace("Matrix", quietly = TRUE)) { expect_s3_class(Matrix::Matrix(), "Matrix") } if (requireNamespace("Matrix", quietly = TRUE)) { expect_s3_class(Matrix::Matrix(), NA) }
expect_s3_class(data.frame(), "data.frame") expect_s3_class(1L, "integer") expect_s3_class(1L, NA) if (requireNamespace("Matrix", quietly = TRUE)) { expect_s3_class(Matrix::Matrix(), "Matrix") } if (requireNamespace("Matrix", quietly = TRUE)) { expect_s3_class(Matrix::Matrix(), NA) }
Check that current
is an S4 object that is of class class
expect_s4_class(current, class, ..., info = NA_character_)
expect_s4_class(current, class, ..., info = NA_character_)
current |
|
class |
|
... |
Ignored |
info |
|
A tinytest
object. A tinytest object is a
logical
with attributes holding information about the
test that was run
testthat equivalent:
testthat::expect_s4_class()
Other inheritance:
expect_s3_class()
,
expect_type()
if (requireNamespace("Matrix", quietly = TRUE)) { expect_s4_class(Matrix::Matrix(), "Matrix") } expect_s4_class(data.frame(), "data.frame") expect_s4_class(data.frame(), NA)
if (requireNamespace("Matrix", quietly = TRUE)) { expect_s4_class(Matrix::Matrix(), "Matrix") } expect_s4_class(data.frame(), "data.frame") expect_s4_class(data.frame(), NA)
Check that typeof(current)
is type
expect_type(current, type, ..., info = NA_character_)
expect_type(current, type, ..., info = NA_character_)
current |
|
type |
|
... |
Ignored |
info |
|
A tinytest
object. A tinytest object is a
logical
with attributes holding information about the
test that was run
testthat equivalent:
testthat::expect_type()
Other inheritance:
expect_s3_class()
,
expect_s4_class()
expect_type(1L, "integer") expect_type(1.0, "integer")
expect_type(1L, "integer") expect_type(1.0, "integer")
Expect Visible
expect_visible(current, ..., info = NA_character_)
expect_visible(current, ..., info = NA_character_)
current |
|
... |
Ignored |
info |
|
A tinytest
object. A tinytest object is a
logical
with attributes holding information about the
test that was run
testthat equivalent:
testthat::expect_visible()
Other visibility:
expect_invisible()
f <- \() invisible() expect_visible(f()) g <- \() NULL expect_visible(g())
f <- \() invisible() expect_visible(f()) g <- \() NULL expect_visible(g())
Unconditionally stop testing a tinytest test file, preventing
additional tests in the file from running without triggering a failure. This
is the low-level exit function for other skip_()
functions in
tinyexpect
skip(message = "Skipping")
skip(message = "Skipping")
message |
A message describing why the test file is being skipped |
If called within a tinytest test, triggers an exit
condition; otherwise, returns message
testthat equivalent:
testthat::skip()
Other “stop testing” functions:
skip_if_not_installed()
,
skip_on_bioc()
,
skip_on_ci()
,
skip_on_covr()
,
skip_on_cran()
,
skip_on_os()
skip()
skip()
Conditionally stop testing a tinytest test file if a required package is not available or not of a minimum required version
skip_if_not_installed(pkg, minimum_version = NULL, quietly = TRUE) exit_if_not_installed(pkg, minimum_version = NULL, quietly = TRUE)
skip_if_not_installed(pkg, minimum_version = NULL, quietly = TRUE) exit_if_not_installed(pkg, minimum_version = NULL, quietly = TRUE)
pkg |
Name of package to check for |
minimum_version |
Optional minimum required version of |
quietly |
Attempt to find the package quietly; passed to
|
If called within a tinytest test and pkg
is either
not installed or not at least minimum_version
, triggers an exit
condition; otherwise, returns one of
A string saying that pkg
is not installed
A string saying that pkg
is installed, but not
at least minimum_version
NULL
invisibly
tinyexpect provides both “skip_
” and “exit_
”
versions of “stop testing” functions due to the different philosophies
of tinytest and testthat; in testthat, tests
are encapsulated by test_that()
to create smaller
testing units within a single test file. As such, if a series of tests need
to be passed over for some reason, it makes sense to “skip” a
test_that()
block and move on to the next block
tinytest, however, treats each test file as a testing unit. Each
file in inst/tinytest
is equivalent to a testthat
test_that()
block; as such, if a series of tests need
to be passed over for some reason, it makes sense to “exit” a test
file and mnove on to the next file in inst/tinytest
In order to provide compatibility with users transitioning from
testthat to tinytest, and to provide continuity with the
tinytest philosophy, tinyexpect provides both skip_
-
and exit_
- prefixed “stop testing” functions that work
identically to one another
testthat equivalent:
testthat::skip_if_not_installed()
Other “stop testing” functions:
skip()
,
skip_on_bioc()
,
skip_on_ci()
,
skip_on_covr()
,
skip_on_cran()
,
skip_on_os()
pkg <- paste(sample(letters, size = 7L, replace = TRUE), collapse = "") skip_if_not_installed(pkg) skip_if_not_installed("tinyexpect", minimum_version = "99.0.1")
pkg <- paste(sample(letters, size = 7L, replace = TRUE), collapse = "") skip_if_not_installed(pkg) skip_if_not_installed("tinyexpect", minimum_version = "99.0.1")
Stop Testing on the Bioconductor Build System
skip_on_bioc() exit_on_bioc()
skip_on_bioc() exit_on_bioc()
If called within a tinytest test running on the
Bioconductor Build System, triggers an exit condition; otherwise, either
a string saying “On Bioconductor
” or NULL
invisibly
testthat equivalent:
testthat::skip_on_bioc()
Other “stop testing” functions:
skip()
,
skip_if_not_installed()
,
skip_on_ci()
,
skip_on_covr()
,
skip_on_cran()
,
skip_on_os()
if (requireNamespace("withr", quietly = TRUE)) { withr::with_envvar(c(IS_BIOC_BUILD_MACHINE = 'true'), skip_on_bioc()) }
if (requireNamespace("withr", quietly = TRUE)) { withr::with_envvar(c(IS_BIOC_BUILD_MACHINE = 'true'), skip_on_bioc()) }
Stop Testing on CI
skip_on_ci() exit_on_ci()
skip_on_ci() exit_on_ci()
If called within a tinytest test running on CI, triggers
an exit condition; otherwise, either a string saying “On CI
”
or NULL
invisibly
tinyexpect provides both “skip_
” and “exit_
”
versions of “stop testing” functions due to the different philosophies
of tinytest and testthat; in testthat, tests
are encapsulated by test_that()
to create smaller
testing units within a single test file. As such, if a series of tests need
to be passed over for some reason, it makes sense to “skip” a
test_that()
block and move on to the next block
tinytest, however, treats each test file as a testing unit. Each
file in inst/tinytest
is equivalent to a testthat
test_that()
block; as such, if a series of tests need
to be passed over for some reason, it makes sense to “exit” a test
file and mnove on to the next file in inst/tinytest
In order to provide compatibility with users transitioning from
testthat to tinytest, and to provide continuity with the
tinytest philosophy, tinyexpect provides both skip_
-
and exit_
- prefixed “stop testing” functions that work
identically to one another
testthat equivalent:
testthat::skip_on_ci()
Other “stop testing” functions:
skip()
,
skip_if_not_installed()
,
skip_on_bioc()
,
skip_on_covr()
,
skip_on_cran()
,
skip_on_os()
if (requireNamespace("withr", quietly = TRUE)) { withr::with_envvar(c(CI = 'true'), skip_on_ci()) }
if (requireNamespace("withr", quietly = TRUE)) { withr::with_envvar(c(CI = 'true'), skip_on_ci()) }
Stop Testing Under covr
skip_on_covr() exit_on_covr()
skip_on_covr() exit_on_covr()
If called within a tinytest test running under
covr, triggers an exit condition; otherwise, either a
string saying “On covr
” or NULL
invisibly
tinyexpect provides both “skip_
” and “exit_
”
versions of “stop testing” functions due to the different philosophies
of tinytest and testthat; in testthat, tests
are encapsulated by test_that()
to create smaller
testing units within a single test file. As such, if a series of tests need
to be passed over for some reason, it makes sense to “skip” a
test_that()
block and move on to the next block
tinytest, however, treats each test file as a testing unit. Each
file in inst/tinytest
is equivalent to a testthat
test_that()
block; as such, if a series of tests need
to be passed over for some reason, it makes sense to “exit” a test
file and mnove on to the next file in inst/tinytest
In order to provide compatibility with users transitioning from
testthat to tinytest, and to provide continuity with the
tinytest philosophy, tinyexpect provides both skip_
-
and exit_
- prefixed “stop testing” functions that work
identically to one another
testthat equivalent:
testthat::skip_on_covr()
Other “stop testing” functions:
skip()
,
skip_if_not_installed()
,
skip_on_bioc()
,
skip_on_ci()
,
skip_on_cran()
,
skip_on_os()
if (requireNamespace("withr", quietly = TRUE)) { withr::with_envvar(c(R_COVR = 'true'), skip_on_covr()) }
if (requireNamespace("withr", quietly = TRUE)) { withr::with_envvar(c(R_COVR = 'true'), skip_on_covr()) }
Stop Testing on CRAN
skip_on_cran() exit_on_cran()
skip_on_cran() exit_on_cran()
If called within a tinytest test running on CRAN in a
non-interactive session, triggers an exit
condition; otherwise, either a string saying “On CRAN
”
or NULL
invisibly
tinyexpect provides both “skip_
” and “exit_
”
versions of “stop testing” functions due to the different philosophies
of tinytest and testthat; in testthat, tests
are encapsulated by test_that()
to create smaller
testing units within a single test file. As such, if a series of tests need
to be passed over for some reason, it makes sense to “skip” a
test_that()
block and move on to the next block
tinytest, however, treats each test file as a testing unit. Each
file in inst/tinytest
is equivalent to a testthat
test_that()
block; as such, if a series of tests need
to be passed over for some reason, it makes sense to “exit” a test
file and mnove on to the next file in inst/tinytest
In order to provide compatibility with users transitioning from
testthat to tinytest, and to provide continuity with the
tinytest philosophy, tinyexpect provides both skip_
-
and exit_
- prefixed “stop testing” functions that work
identically to one another
testthat equivalent:
testthat::skip_on_cran()
Other “stop testing” functions:
skip()
,
skip_if_not_installed()
,
skip_on_bioc()
,
skip_on_ci()
,
skip_on_covr()
,
skip_on_os()
if (requireNamespace("withr", quietly = TRUE)) { withr::with_envvar(c(NOT_CRAN = 'false'), skip_on_cran()) }
if (requireNamespace("withr", quietly = TRUE)) { withr::with_envvar(c(NOT_CRAN = 'false'), skip_on_cran()) }
Stop Testing on Specific Operating Systems and Architectures
skip_on_os(os, arch = NULL) exit_on_os(os, arch = NULL)
skip_on_os(os, arch = NULL) exit_on_os(os, arch = NULL)
os |
Operating system to not test on; choose one or more from:
The following OS designations are accepted as synonyms:
Pass |
arch |
Optional system architectures to not test on; note that this
only applies to operating systems present in |
If called within a tinytest test running under os
and potentially on an arch
system, triggers an exit condition;
otherwise, returns one of
A string saying that the code is running under os
A string saying that the code is running under os
on an
arch
system
NULL
invisibly
tinyexpect provides both “skip_
” and “exit_
”
versions of “stop testing” functions due to the different philosophies
of tinytest and testthat; in testthat, tests
are encapsulated by test_that()
to create smaller
testing units within a single test file. As such, if a series of tests need
to be passed over for some reason, it makes sense to “skip” a
test_that()
block and move on to the next block
tinytest, however, treats each test file as a testing unit. Each
file in inst/tinytest
is equivalent to a testthat
test_that()
block; as such, if a series of tests need
to be passed over for some reason, it makes sense to “exit” a test
file and mnove on to the next file in inst/tinytest
In order to provide compatibility with users transitioning from
testthat to tinytest, and to provide continuity with the
tinytest philosophy, tinyexpect provides both skip_
-
and exit_
- prefixed “stop testing” functions that work
identically to one another
testthat equivalent:
testthat::skip_on_os()
Tools for querying system OS and architecture:
Sys.info()
, R.version[["arch"]]
Other “stop testing” functions:
skip()
,
skip_if_not_installed()
,
skip_on_bioc()
,
skip_on_ci()
,
skip_on_covr()
,
skip_on_cran()
(system <- tolower(Sys.info()[["sysname"]])) skip_on_os(system) # Nothing happens if on a different OS (other <- sample(setdiff(c("windows", "mac", "linux", "solaris"), system), size = 1L)) skip_on_os(other) # System architectures can be used to fine-tune skips (sysarch <- R.version$arch) skip_on_os(system, arch = sysarch)
(system <- tolower(Sys.info()[["sysname"]])) skip_on_os(system) # Nothing happens if on a different OS (other <- sample(setdiff(c("windows", "mac", "linux", "solaris"), system), size = 1L)) skip_on_os(other) # System architectures can be used to fine-tune skips (sysarch <- R.version$arch) skip_on_os(system, arch = sysarch)