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 May 29, 2024, 6:47 a.m.