tests/testthat/test-either_of.R

context("test-either_of")

test_that("rx_either_of works", {

  x <- rx() %>%
    rx_either_of("cat", "dog") %>%
    rx_space() %>%
    rx_find("food")

  string <- c("dog food", "cat food", "fish food")

  # expect only two matches in above example
  expect_equal(table(grepl(x, string))[["TRUE"]], 2)

})

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.