local_testthat {fmesher} | R Documentation |
Unit test helpers
Description
Local helper functions for package unit tests
Usage
local_fm_testthat_assign(x, values, envir = parent.frame())
local_fm_testthat_tolerances(
tolerances = c(1e-04, 0.01, 0.1),
envir = parent.frame()
)
local_fm_testthat_setup(envir = parent.frame())
Arguments
x |
character; Name of variable to assign to |
values |
the object to assign to |
envir |
environment for exit handlers |
tolerances |
numeric vector of length 3; |
Value
None
Functions
-
local_fm_testthat_assign()
: Assign local variable. Useful for easy cleanup of global workspace withwithr::deferred_run()
when running tests interactively. -
local_fm_testthat_tolerances()
: Assign test tolerances Assign local tolerance variables. Useful for easy cleanup of global workspace withwithr::deferred_run()
when running tests interactively. -
local_fm_testthat_setup()
: Initialise environment for tests. To be called either at the top of a testfile, or inside tests.
Examples
outer_fun <- function() {
fun <- function(envir = parent.frame()) {
local_fm_testthat_assign("local_var_name", 1:4, envir = envir)
}
fun()
local_var_name
}
exists("local_var_name")
outer_fun()
exists("local_var_name")
[Package fmesher version 0.5.0 Index]