tests/testthat/test_crate.R

test_that("crate", {
  meta_f = function(z) {
    x = 1
    y = 2
    crate(function() {
      c(x, y, z)
    }, x, .parent = parent.frame())
  }
  x = 100
  y = 200
  z = 300
  f = meta_f(1)
  expect_equal(f(), c(1, 200, 300))
})

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.