dwww Home | Show directory contents | Find package

context("on-failure")

test_that("on_failure should work", {
  is_red <- function(x) {x == "red"}
  on_failure(is_red) <- function(call, env) {
      paste0(deparse(call$x), " is not red")
  }
  
  res <- see_if(is_red("blue"))
  expect_false(res[[1]])
  expect_identical(attr(res, "msg"), '"blue" is not red')
})

Generated by dwww version 1.15 on Wed May 22 19:17:43 CEST 2024.