tests/testthat/test_ids.R

test_that("ids", {
  Foo = R6::R6Class("Foo", public = list(id = NULL, initialize = function(id) self$id = id), cloneable = TRUE)
  f1 = Foo$new("f1")
  f2 = Foo$new("f2")
  xs = list(f1, f2)
  expect_equal(ids(xs), c("f1", "f2"))
  expect_equal(ids(list()), character())
})

Try the mlr3misc package in your browser

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

mlr3misc documentation built on Sept. 20, 2023, 5:06 p.m.