tests/testthat/test-regex-break.R

library(testthat)
library(campfin)

test_that("regex word breaks can be prevent intra-word replacement", {
  x <- "this is a testing string"
  y <- str_replace(x, rx_break("sting"), "TEST")
  expect_equal(x, y)
  x <- "testing one two three"
  y <- str_replace(x, rx_break("test"), "abdc")
  expect_equal(x, y)
})

Try the campfin package in your browser

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

campfin documentation built on Oct. 20, 2023, 5:06 p.m.