tests/test_hasName.R

source("helper/helper.R")

if (exists("hasName", envir = getNamespace("utils"))) {
  f = get("hasName", envir = getNamespace("utils"))
  expect_same = makeCompareFun(f, backports:::hasName)

  x = list(1, a = 12, bbb = 99)
  expect_same(x, "a")
  expect_same(x, "c")
  expect_same(x, "bbb")
  expect_same(x, "b")
}

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.