tests/testthat/test-testthat-wrappers.R

testthat::test_that("testthat wrappers return the object", {
  expect_equal(
    expect_message_obj(
      {
        message("abc")
        "foo"
      },
      "a"
    ),
    "foo"
  )
  expect_equal(
    expect_warning_obj(
      {
        warning("abc")
        "foo"
      },
      "a"
    ),
    "foo"
  )
  expect_equal(
    expect_condition_obj(
      {
        message("abc")
        "foo"
      },
      "a"
    ),
    "foo"
  )
})

Try the dm package in your browser

Any scripts or data that you put into this service are public.

dm documentation built on Nov. 2, 2023, 6:07 p.m.