tests/testthat/test_validator.R

context("Test user-defined Validators.")
library(shinyreforms)


test_that("ValidatorNonEmpty works", {
  anythingButTestValidator <- Validator$new(function(value) {
    return(value != "test")
  }, "Please input *anything* but test!")

  expect_true(anythingButTestValidator$check("Some value!"))
  expect_false(anythingButTestValidator$check("test"))
})

Try the shinyreforms package in your browser

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

shinyreforms documentation built on July 2, 2020, 1:33 a.m.