tests/testthat/test-s3-externalptr.R

test_that("externalptr", {
  expect_snapshot({
    dt <- data.table::data.table(a = 1)
    class(dt) <- "data.frame"
    construct(dt, check = FALSE)

    classed_ptr <- structure(attr(dt, ".internal.selfref"), class = "foo")
    construct(classed_ptr, check = FALSE)
  })
})

Try the constructive package in your browser

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

constructive documentation built on Nov. 5, 2025, 7:14 p.m.