tests/testthat/test-s3-externalptr.R

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

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

Try the constructive package in your browser

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

constructive documentation built on April 3, 2025, 9:39 p.m.