R Under development (unstable) (2025-06-04 r88278 ucrt) -- "Unsuffered Consequences" Copyright (C) 2025 The R Foundation for Statistical Computing Platform: x86_64-w64-mingw32/x64 R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. > ## This runs testme test script inst/testme/test-globals,tricky.R > ## Don't edit - it was autogenerated by inst/testme/deploy.R > future.callr:::testme("globals,tricky") Test 'globals,tricky' ... Sourcing 9 prologue scripts ... 01/09 prologue script 'D:/RCompile/CRANincoming/R-devel/lib/future.callr/testme/_prologue/001.load.R' 02/09 prologue script 'D:/RCompile/CRANincoming/R-devel/lib/future.callr/testme/_prologue/002.record-state.R' 03/09 prologue script 'D:/RCompile/CRANincoming/R-devel/lib/future.callr/testme/_prologue/030.imports.R' 04/09 prologue script 'D:/RCompile/CRANincoming/R-devel/lib/future.callr/testme/_prologue/050.utils.R' 05/09 prologue script 'D:/RCompile/CRANincoming/R-devel/lib/future.callr/testme/_prologue/090.context.R' 06/09 prologue script 'D:/RCompile/CRANincoming/R-devel/lib/future.callr/testme/_prologue/090.options.R' 07/09 prologue script 'D:/RCompile/CRANincoming/R-devel/lib/future.callr/testme/_prologue/091.envvars.R' 08/09 prologue script 'D:/RCompile/CRANincoming/R-devel/lib/future.callr/testme/_prologue/099.future-setup.R' 09/09 prologue script 'D:/RCompile/CRANincoming/R-devel/lib/future.callr/testme/_prologue/995.detrius-connections.R' Sourcing 9 prologue scripts ... done Running test script: 'D:/RCompile/CRANincoming/R-devel/lib/future.callr/testme/test-globals,tricky.R' > library(future.callr) Loading required package: future > library(listenv) > plan(callr) > message("*** Tricky use cases related to globals ...") *** Tricky use cases related to globals ... > message("- Globals with the same name as 'base' objects ...") - Globals with the same name as 'base' objects ... > col <- 3 > x %<-% { + stopifnot(is.numeric(col)) + col + } > print(x) [1] 3 > stopifnot(x == col) > message("- flapply(x, FUN = base::vector, ...) ...") - flapply(x, FUN = base::vector, ...) ... > flapply <- function(x, FUN, ...) { + res <- listenv() + for (ii in seq_along(x)) { + res[[ii]] %<-% FUN(x[[ii]], ...) + } + .... [TRUNCATED] > x <- list(a = "integer", b = "numeric", c = "character", + c = "list") > str(list(x = x)) List of 1 $ x:List of 4 ..$ a: chr "integer" ..$ b: chr "numeric" ..$ c: chr "character" ..$ c: chr "list" > y0 <- lapply(x, FUN = base::vector, length = 2) > str(list(y0 = y0)) List of 1 $ y0:List of 4 ..$ a: int [1:2] 0 0 ..$ b: num [1:2] 0 0 ..$ c: chr [1:2] "" "" ..$ c:List of 2 .. ..$ : NULL .. ..$ : NULL > y <- flapply(x, FUN = base::vector, length = 2) > str(list(y = y)) List of 1 $ y:List of 4 ..$ a: int [1:2] 0 0 ..$ b: num [1:2] 0 0 ..$ c: chr [1:2] "" "" ..$ c:List of 2 .. ..$ : NULL .. ..$ : NULL > stopifnot(identical(y, y0)) > message("- flapply(x, FUN = future:::hpaste, ...) ...") - flapply(x, FUN = future:::hpaste, ...) ... > x <- list(a = c("hello", b = 1:100)) > str(list(x = x)) List of 1 $ x:List of 1 ..$ a: Named chr [1:101] "hello" "1" "2" "3" ... .. ..- attr(*, "names")= chr [1:101] "" "b1" "b2" "b3" ... > y0 <- lapply(x, FUN = future:::hpaste, collapse = "; ", + maxHead = 3) > str(list(y0 = y0)) List of 1 $ y0:List of 1 ..$ a: chr "hello; 1; 2; ...; 100" > y <- flapply(x, FUN = future:::hpaste, collapse = "; ", + maxHead = 3) > str(list(y = y)) List of 1 $ y:List of 1 ..$ a: chr "hello; 1; 2; ...; 100" > stopifnot(identical(y, y0)) > message("- flapply(x, FUN = listenv::listenv, ...) ...") - flapply(x, FUN = listenv::listenv, ...) ... > x <- list() > y <- listenv() > y$A <- 3 > x$a <- y > y <- listenv() > y$A <- 3 > y$B <- c("hello", b = 1:100) > x$b <- y > print(x) $a A 'listenv' vector with 1 element ('A'). $b A 'listenv' vector with 2 elements ('A', 'B'). > y0 <- lapply(x, FUN = listenv::mapping) > str(list(y0 = y0)) List of 1 $ y0:List of 2 ..$ a: Named chr "A" .. ..- attr(*, "names")= chr "A" ..$ b: Named chr [1:2] "A" "B" .. ..- attr(*, "names")= chr [1:2] "A" "B" > y <- flapply(x, FUN = listenv::mapping) > str(list(y = y)) List of 1 $ y:List of 2 ..$ a: Named chr "A" .. ..- attr(*, "names")= chr "A" ..$ b: Named chr [1:2] "A" "B" .. ..- attr(*, "names")= chr [1:2] "A" "B" > stopifnot(identical(y, y0)) > message("*** Tricky use cases related to globals ... DONE") *** Tricky use cases related to globals ... DONE Sourcing 6 epilogue scripts ... 01/06 epilogue script 'D:/RCompile/CRANincoming/R-devel/lib/future.callr/testme/_epilogue/001.undo-future.R' 02/06 epilogue script 'D:/RCompile/CRANincoming/R-devel/lib/future.callr/testme/_epilogue/002.undo-state.R' Failed to undo environment variables: - Expected environment variables: [n=213] '!ExitCode', 'ALLUSERSPROFILE', 'APPDATA', ..., 'tempdirname' - Environment variables still there: [n=0] - Environment variables missing: [n=1] 'MAKEFLAGS' Differences environment variable by environment variable: 03/06 epilogue script 'D:/RCompile/CRANincoming/R-devel/lib/future.callr/testme/_epilogue/090.gc.R' 04/06 epilogue script 'D:/RCompile/CRANincoming/R-devel/lib/future.callr/testme/_epilogue/099.session_info.R' 05/06 epilogue script 'D:/RCompile/CRANincoming/R-devel/lib/future.callr/testme/_epilogue/995.detritus-connections.R' 06/06 epilogue script 'D:/RCompile/CRANincoming/R-devel/lib/future.callr/testme/_epilogue/999.detritus-files.R' Skipping, because path appears not to be an 'R CMD check' folder: 'D:/temp/2025_06_05_19_20_16_14476' Sourcing 6 epilogue scripts ... done Test time: user.self=0.8s, sys.self=0.06s, elapsed=3s, user.child=NAs, sys.child=NAs Test 'tempdirname' ... success > > proc.time() user system elapsed 1.00 0.21 3.14