ignore {tinytest} | R Documentation |
Ignore the output of an expectation
Description
Ignored expectations are not reported in the test results.
Ignoring is only useful for test files, and not for use directly
at the command-line. See also the package vignette: vignette("using_tinytest")
.
Usage
ignore(fun)
Arguments
fun |
|
Value
An ignored function
Details
ignore
is a higher-order function: a function that returns another function.
In particular, it accepts a function and returns a function that is almost identical
to the input function. The only difference is that the return value of the function
returned by ignore
is not caught by run_test_file
and friends.
For example, ignore(expect_true)
is a function, and we can use it as
ignore(expect_true)( 1 == 1)
. The return value of ignore(expect_true)(1==1)
is exactly the same as that for expect_true(1==1)
.
See Also
Other test-functions:
expect_equal_to_reference()
,
expect_equal()
,
expect_length()
,
expect_match()
Examples
## The result of 'expect_warning' is not stored in the test result when
## this is run from a file.
expect_true( ignore(expect_warning)(warning("foo!")) )
## Note the placement of the brackets in ignore(expect_warning)(...).