Skip to content

Commit

Permalink
Add test of the, currently internal, capture_journals() function
Browse files Browse the repository at this point in the history
  • Loading branch information
HenrikBengtsson committed Jan 30, 2024
1 parent ef4d651 commit d874af5
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 1 deletion.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Package: future
Version: 1.33.1-9002
Version: 1.33.1-9003
Title: Unified Parallel and Distributed Processing in R for Everyone
Imports:
digest,
Expand Down
27 changes: 27 additions & 0 deletions tests/capture_journals.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
source("incl/start.R")

capture_journals <- future:::capture_journals

message("*** capture_journals() ...")

slow_fcn <- function(x) {
Sys.sleep(0.5 + 1/x)
}

plan(multisession, workers = 2)
js <- capture_journals({
fs <- lapply(3:1, FUN = function(x) future(slow_fcn(x)))
vs <- value(fs)
})
print(js)
stopifnot(
is.list(js),
all(vapply(js, FUN = is.data.frame, FUN.VALUE = NA))
)

## Shut down parallel workers
plan(sequential)

message("*** capture_journals() ... done")

source("incl/end.R")

0 comments on commit d874af5

Please sign in to comment.