tests/testthat/test-igrepl.R

library(testthat)
library(NUSS)

test_that("igrepl matches patterns in string correctly", {
  expect_equal(
    NUSS::igrepl(c("today",
                   "b.* fox",
                   "jumps over",
                   "vigorous"),
                 "The quick brown fox jumps over the lazy dog", FALSE),
    c(FALSE, TRUE, TRUE, FALSE))
  expect_equal(
    NUSS::igrepl(c("today",
                   "brown fox",
                   "jumps over",
                   "vigorous"),
                 "The quick brown fox jumps over the lazy dog", TRUE),
    c(FALSE, TRUE, TRUE, FALSE))
})

Try the NUSS package in your browser

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

NUSS documentation built on Sept. 11, 2024, 5:30 p.m.