tests/testthat/test_hasAttributes.R

context("hasAttributes")

test_that("hasAttributes detects whether given attributes are set or not", {
  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))
})
jakobbossek/JBmisc documentation built on May 18, 2019, 9:08 a.m.