Examples for 'testthat::expect_invisible'


Does code return a visible or invisible object?

Aliases: expect_invisible expect_visible

Keywords:

### ** Examples

expect_invisible(x <- 10)
expect_visible(x)

# Typically you'll assign the result of the expectation so you can
# also check that the value is as you expect.
greet <- function(name) {
  message("Hi ", name)
  invisible(name)
}
out <- expect_invisible(greet("Hadley"))
Hi Hadley
expect_equal(out, "Hadley")

[Package testthat version 3.1.4 Index]