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)
})
r-lib/pkgcache documentation built on April 7, 2024, 5:57 a.m.