Skip to content

Commit df6fba6

Browse files
TESTS: Add test that failed with future (<= 1.40.0)
1 parent a209d05 commit df6fba6

1 file changed

Lines changed: 43 additions & 0 deletions

File tree

tests/globals,tricky2.R

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
source("incl/start.R")
2+
options(future.debug = FALSE)
3+
4+
foo <- function(..., FUN = function(...) list(...)) {
5+
args <- list(...)
6+
future_lapply(1L, FUN = function(x) {
7+
do.call(FUN, args = c(list(x), args))
8+
})
9+
}
10+
11+
bar <- function(..., fun = function(...) list(...)) {
12+
future_lapply(1L, FUN = function(x) fun(x, ...))
13+
}
14+
15+
yaa <- function(..., FUN = function(...) list(...)) {
16+
future_lapply(1L, FUN = function(x) {
17+
do.call(FUN, args = c(list(x), ...))
18+
})
19+
}
20+
21+
22+
for (strategy in supportedStrategies()) {
23+
message(sprintf("- plan('%s') ...", strategy))
24+
plan(strategy)
25+
26+
x1 <- foo()
27+
y1 <- bar()
28+
stopifnot(identical(y1, x1))
29+
z1 <- yaa()
30+
stopifnot(identical(z1, x1))
31+
32+
x2 <- foo(a = 2)
33+
if (packageVersion("future") > "1.40.0-9200") {
34+
y2 <- bar(a = 2)
35+
z2 <- yaa(a = 2)
36+
stopifnot(identical(y2, x2))
37+
stopifnot(identical(z2, x2))
38+
}
39+
40+
message(sprintf("- plan('%s') ... done", strategy))
41+
}
42+
43+
source("incl/end.R")

0 commit comments

Comments
 (0)