tests/testthat/test-singleize.R

test_that("`str_singleize()` works", {
  expect_equal(str_singleize("abc//def", "/"), "abc/def")
  expect_equal(str_singleize("abababcabab", "ab"), "abcab")
  expect_equal(str_singleize(c("abab", "cdcd"), "cd"), c("abab", "cd"))
  expect_equal(
    str_singleize(c("abab", "cdcd"), c("ab", "cd")),
    c("ab", "cd")
  )
  expect_equal(str_singleize(character(), "abc"), character())
})

Try the strex package in your browser

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

strex documentation built on Nov. 2, 2023, 6:04 p.m.