tests/testthat/helper-generator.R

test_generator <- function() {
  Sys.setenv(RETURN_ON_DISPATCH = "true")
  generate_abc <- coro::generator(function() {
    withr::defer(Sys.unsetenv("RETURN_ON_DISPATCH"))
    for (x in c("a", "b", "c")) {
      coro::yield(x)
    }
  })

  generate_abc()
}

Try the streamy package in your browser

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

streamy documentation built on June 8, 2025, 10:50 a.m.