Learn R Programming

testthat (version 0.6)

shows_message: Expectation: does expression show a message?

Description

Needs to match at least one of the messages produced by the expression.

Usage

shows_message(regexp = NULL)

expect_message(object, regexp = NULL, info = NULL, label = NULL)

Arguments

regexp
optional regular expression to match. If not specified, just asserts that expression shows some message.
object
object to test
info
extra information to be included in the message (useful when writing tests in loops).
label
object label. When NULL, computed from deparsed object.

See Also

Other expectations: equals, expect_equal, expect_equivalent, expect_error, expect_false, expect_identical, expect_is, expect_match, expect_output, expect_true, expect_warning, gives_warning, is_a, is_equivalent_to, is_false, is_identical_to, is_true, matches, prints_text, takes_less_than, throws_error

Examples

Run this code
expect_that(message("a"), shows_message())
expect_that(message("a"), shows_message("a"))

Run the code above in your browser using DataLab