tests/async/test-sequence.R

test_that("async_sequence", {

  add1 <- function(n) { n ; delay(10/1000)$then(function(value) n + 1) }
  mul3 <- function(n) { n ; delay(10/1000)$then(function(value) n * 3) }

  add1mul3 <- async_sequence(add1, mul3)
  result <- synchronise(add1mul3(4))

  expect_equal(result, 15)
})

Try the pkgcache package in your browser

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

pkgcache documentation built on July 26, 2023, 5:44 p.m.