tests/testthat/test-something.R

context("test-rx_something")

test_that("something rule works", {

  # expect match
  expect_true(grepl(rx_something(), "something"))
  expect_true(grepl(rx_something(mode="lazy"), "something"))

  # expect match
  expect_true(grepl(rx_something(), " "))
  expect_true(grepl(rx_something(mode="lazy"), " "))

  # dont expect match
  expect_false(grepl(rx_something(), ""))
  expect_false(grepl(rx_something(mode = "lazy"), ""))

  # expect an error if invalid 'mode' is given
  expect_error(rx_something(mode = "whatever"))
})

Try the RVerbalExpressions package in your browser

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

RVerbalExpressions documentation built on Nov. 6, 2019, 5:08 p.m.