tests/testthat/test-reflect.R

test_that("async_reflect", {

  badfun <- async(function() stop("oh no!"))
  safefun <- async_reflect(badfun)

  do <- async(function() {
    when_all(safefun(), safefun(), safefun())$
      then(function(result) {
        for (i in 1:3) {
          expect_s3_class(result[[i]]$error, "error")
          expect_null(result[[i]]$value)
        }
      })
  })
  synchronise(do())
})
gaborcsardi/async documentation built on Nov. 20, 2024, 4:51 p.m.