tests/testthat/stringr-imported/test-escape.R

test_that("multiplication works", {
  expect_equal(
    str_escape(".^$|*+?{}[]()"),
    "\\.\\^\\$\\|\\*\\+\\?\\{\\}\\[\\]\\(\\)"
  )
  expect_equal(str_escape("\\"), "\\\\")
})

test_that("str_escape() preserves names", {
  x <- c(C = "3", B = "2", A = "1")
  expect_equal(names(str_escape(x)), names(x))
})

Try the charr package in your browser

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

charr documentation built on Nov. 7, 2026, 9:06 a.m.