inst/testme/test-future,labels.R

#' @tags labels
#' @tags sequential multisession multicore

library(future)

message("*** Futures - labels ...")

strategies <- supportedStrategies()

for (strategy in strategies) {
  message(sprintf("- plan('%s') ...", strategy))
  plan(strategy)

  for (label in list(NULL, sprintf("strategy = %s", strategy))) {
    fcn <- get(strategy, mode = "function")
    stopifnot(inherits(fcn, strategy))

    f <- future(42, label = label)
    print(f)
    stopifnot(identical(f[["label"]], label))
    v <- value(f)
    stopifnot(v == 42)

    v %<-% { 42 } %label% label
    f <- futureOf(v)
    print(f)
    stopifnot(identical(f[["label"]], label))
    stopifnot(v == 42)

  } ## for (label ...)

  message(sprintf("- plan('%s') ... DONE", strategy))
} ## for (strategy ...)

message("*** Futures - labels ... DONE")
HenrikBengtsson/future documentation built on June 8, 2025, 10:58 p.m.