tests/testthat/test-is.R

test_that("Checking R6 class objects are recognized correctly by `is.R6()`", {
  Person <- R6Class("Person")
  Bob <- Person$new()
  expect_true(is.R6(Bob))
})

test_that("Checking R6 class generators are recognized correctly by `is.R6Class()`", {
  Person <- R6Class("Person")
  expect_true(is.R6Class(Person))
})

Try the R6 package in your browser

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

R6 documentation built on April 3, 2025, 8:49 p.m.