tests/testthat/test-base-comparison.R

context("base-comparison")

test_that("assert_that respects custom error messages for base operators", {
  expect_error(assert_that(5 == 'i'), "not equal to")
  expect_error(assert_that(5 < 4), "not less than")
  expect_error(assert_that(4 > 5), "not greater than")
  expect_error(assert_that(4 >= 5), "not greater than or equal to")
  expect_error(assert_that(5 <= 4), "not less than or equal to")
  expect_error(assert_that(5 != 5), "not equal to")
})
hadley/assertthat documentation built on June 5, 2019, 2:02 p.m.