Skip to contents

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

[function] An expect_ function

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

Examples

# \donttest{
   ## 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!")) )
#> ----- PASSED      : <-->
#>  call| eval(expr, envir) 
   ## Note the placement of the brackets in ignore(expect_warning)(...).
 # }