tests/test_trimws.R

source("helper/helper.R")

if (exists("trimws", envir = baseenv())) {
  f = get("trimws", envir = baseenv())
  expect_same = makeCompareFun(f, backports:::trimws)

  expect_same("")
  expect_same(NA)
  expect_same(NA_character_)
  expect_same(sprintf(" %s ", letters))
  expect_same(" x ")
  expect_same(" x ", which = "both")
  expect_same(" x ", which = "left")
  expect_same(" x ", which = "right")
  expect_same(1)
}

Try the backports package in your browser

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

backports documentation built on June 24, 2024, 5:24 p.m.