| throws_error {testthat} | R Documentation |
Expectation: does expression throw an error?
throws_error(regexp = NULL)
expect_error(object, regexp = NULL, info = NULL,
label = NULL)
regexp |
optional regular expression to match. If not specified, just asserts that expression throws some error. |
object |
object to test |
info |
extra information to be included in the message (useful when writing tests in loops). |
label |
object label. When |
Other expectations: equals,
expect_equal,
expect_equivalent,
expect_false,
expect_identical, expect_is,
expect_match, expect_message,
expect_output, expect_true,
expect_warning,
gives_warning, is_a,
is_equivalent_to, is_false,
is_identical_to, is_true,
matches, prints_text,
shows_message,
takes_less_than
expect_that(log("a"), throws_error())
expect_error(log("a"))
expect_that(log("a"), throws_error("Non-numeric argument"))
expect_error(log("a"), "Non-numeric argument")