tests/testthat/test_named_list.R

test_that("named_list", {
  expect_equal(named_list(character()), setNames(vector("list", 0), nm = character()))
  expect_equal(named_list(), setNames(vector("list", 0), nm = character()))
  expect_equal(named_list("a"), list(a = NULL))
  expect_equal(named_list(c("a", "b")), list(a = NULL, b = NULL))
  expect_equal(named_list(c("a", "b"), 1), list(a = 1, b = 1))
})

Try the mlr3misc package in your browser

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

mlr3misc documentation built on June 25, 2024, 1:07 a.m.