expect_silent: Does code execute silently?

Description Usage Arguments Value See Also Examples

View source: R/expect-silent.R

Description

Checks that the code produces no output, messages, or warnings.

Usage

1
expect_silent(object)

Arguments

object

Object to test.

Supports limited unquoting to make it easier to generate readable failures within a function or for loop. See quasi_label for more details.

Value

The first argument, invisibly.

See Also

Other expectations: comparison-expectations, equality-expectations, expect_error(), expect_length(), expect_match(), expect_named(), expect_null(), expect_output(), expect_reference(), inheritance-expectations, logical-expectations

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
expect_silent("123")

f <- function() {
  message("Hi!")
  warning("Hey!!")
  print("OY!!!")
}
## Not run: 
expect_silent(f())

## End(Not run)

r-lib/testthat documentation built on Sept. 25, 2021, 3:02 p.m.