| prints_text {testthat} | R Documentation |
Expectation: does printed output match a regular expression?
prints_text(regexp, ...)
expect_output(object, regexp, ..., info = NULL,
label = NULL)
regexp |
regular expression to test against |
... |
other arguments passed to |
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_error, expect_false,
expect_identical, expect_is,
expect_match, expect_message,
expect_true, expect_warning,
gives_warning, is_a,
is_equivalent_to, is_false,
is_identical_to, is_true,
matches, shows_message,
takes_less_than, throws_error
str(mtcars)
expect_that(str(mtcars), prints_text("32 obs"))
expect_that(str(mtcars), prints_text("11 variables"))
expect_output(str(mtcars), "11 variables")