-
Notifications
You must be signed in to change notification settings - Fork 337
Closed
Description
e.g.
context("expect_output")
f <- function() NULL
g <- function() cat("!")
test_that("expect = NA checks for no output", {
expect_error(expect_output(f(), NA), NA)
expect_error(expect_output(g(), NA), "produced output")
})
test_that("expect = NULL checks for some output", {
expect_error(expect_output(f(), NULL), "didn't produce output")
expect_error(expect_output(g(), NULL), NA)
})
test_that("expect = string checks for match", {
expect_error(expect_output(g(), "!"), NA)
expect_error(expect_output(g(), "x"), "does not match 'x'")
})
And each expectation needs its own test file.
Metadata
Metadata
Assignees
Labels
No labels