tests/testthat/test_hasAttributes.R

context("hasAttributes")

test_that("hasAttributes", {
  x = 1:10
  attribute.names = c("size", "importance")

  expect_false(hasAttributes(x, attribute.names))

  attr(x, "size") = length(x)
  expect_false(hasAttributes(x, attribute.names))

  attr(x, "importance") = "very important"
  expect_true(hasAttributes(x, attribute.names))
})

Try the BBmisc package in your browser

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

BBmisc documentation built on Sept. 29, 2022, 5:12 p.m.