R Under development (unstable) (2026-03-12 r89611 ucrt) -- "Unsuffered Consequences" Copyright (C) 2026 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-globalsOf.R > ## Don't edit - it was autogenerated by inst/testme/deploy.R > globals:::testme("globalsOf") Test 'globalsOf' ... Sourcing 9 prologue scripts ... 01/09 prologue script 'D:/RCompile/CRANincoming/R-devel/lib/globals/testme/_prologue/001.load.R' 02/09 prologue script 'D:/RCompile/CRANincoming/R-devel/lib/globals/testme/_prologue/005.globals.R' 03/09 prologue script 'D:/RCompile/CRANincoming/R-devel/lib/globals/testme/_prologue/010.record-state.R' 04/09 prologue script 'D:/RCompile/CRANincoming/R-devel/lib/globals/testme/_prologue/030.imports.R' 05/09 prologue script 'D:/RCompile/CRANincoming/R-devel/lib/globals/testme/_prologue/050.utils.R' 06/09 prologue script 'D:/RCompile/CRANincoming/R-devel/lib/globals/testme/_prologue/090.context.R' 07/09 prologue script 'D:/RCompile/CRANincoming/R-devel/lib/globals/testme/_prologue/090.options.R' 08/09 prologue script 'D:/RCompile/CRANincoming/R-devel/lib/globals/testme/_prologue/091.envvars.R' 09/09 prologue script 'D:/RCompile/CRANincoming/R-devel/lib/globals/testme/_prologue/995.detrius-connections.R' Sourcing 9 prologue scripts ... done Running test script: 'D:/RCompile/CRANincoming/R-devel/lib/globals/testme/test-globalsOf.R' > library(globals) > message("*** globalsOf() ...") *** globalsOf() ... > message(" ** globalsOf(..., method = 'conservative'):") ** globalsOf(..., method = 'conservative'): > expr <- exprs$A > globals_c <- globalsOf(expr, method = "conservative") > str(globals_c) List of 5 $ { :.Primitive("{") $ <-:.Primitive("<-") $ c : num 3 $ d : NULL $ + :function (e1, e2) - attr(*, "where")=List of 5 ..$ { : ..$ <-: ..$ c : ..$ d : ..$ + : - attr(*, "class")= chr [1:2] "Globals" "list" > assert_identical_sets(names(globals_c), c("{", "<-", + "c", "d", "+")) > globals_c <- cleanup(globals_c) > str(globals_c) List of 2 $ c: num 3 $ d: NULL - attr(*, "where")=List of 2 ..$ c: ..$ d: - attr(*, "class")= chr [1:2] "Globals" "list" > assert_identical_sets(names(globals_c), c("c", "d")) > where <- attr(globals_c, "where") > stopifnot(length(where) == length(globals_c), identical(where$c, + globalenv()), identical(where$d, globalenv())) > message(" ** globalsOf(..., method = 'liberal'):") ** globalsOf(..., method = 'liberal'): > expr <- exprs$A > globals_l <- globalsOf(expr, method = "liberal") > str(globals_l) List of 8 $ { :.Primitive("{") $ <-:.Primitive("<-") $ b : num 2 $ c : num 3 $ d : NULL $ + :function (e1, e2) $ a : num 0 $ e :function () - attr(*, "where")=List of 8 ..$ { : ..$ <-: ..$ b : ..$ c : ..$ d : ..$ + : ..$ a : ..$ e : - attr(*, "class")= chr [1:2] "Globals" "list" > assert_identical_sets(names(globals_l), c("{", "<-", + "b", "c", "d", "+", "a", "e")) > globals_l <- cleanup(globals_l) > str(globals_l) List of 5 $ b: num 2 $ c: num 3 $ d: NULL $ a: num 0 $ e:function () - attr(*, "where")=List of 5 ..$ b: ..$ c: ..$ d: ..$ a: ..$ e: - attr(*, "class")= chr [1:2] "Globals" "list" > assert_identical_sets(names(globals_l), c("b", "c", + "d", "a", "e")) > where <- attr(globals_l, "where") > stopifnot(length(where) == length(globals_l), identical(where$b, + globalenv()), identical(where$c, globalenv()), identical(where$d, + glo .... [TRUNCATED] > message(" ** globalsOf(..., method = 'ordered'):") ** globalsOf(..., method = 'ordered'): > expr <- exprs$A > globals_i <- globalsOf(expr, method = "ordered") > str(globals_i) List of 8 $ { :.Primitive("{") $ <-:.Primitive("<-") $ b : num 2 $ c : num 3 $ d : NULL $ a : num 0 $ + :function (e1, e2) $ e :function () - attr(*, "where")=List of 8 ..$ { : ..$ <-: ..$ b : ..$ c : ..$ d : ..$ a : ..$ + : ..$ e : - attr(*, "class")= chr [1:2] "Globals" "list" > assert_identical_sets(names(globals_i), c("{", "<-", + "b", "c", "d", "+", "a", "e")) > globals_i <- cleanup(globals_i) > str(globals_i) List of 5 $ b: num 2 $ c: num 3 $ d: NULL $ a: num 0 $ e:function () - attr(*, "where")=List of 5 ..$ b: ..$ c: ..$ d: ..$ a: ..$ e: - attr(*, "class")= chr [1:2] "Globals" "list" > assert_identical_sets(names(globals_i), c("b", "c", + "d", "a", "e")) > where <- attr(globals_i, "where") > stopifnot(length(where) == length(globals_i), identical(where$b, + globalenv()), identical(where$c, globalenv()), identical(where$d, + glo .... [TRUNCATED] > globals_i <- globalsOf(function(x) x <- x) > print(globals_i) $`<-` .Primitive("<-") attr(,"where") attr(,"where")$`<-` attr(,"class") [1] "Globals" "list" > globals_i <- cleanup(globals_i) > str(globals_i) Named list() - attr(*, "where")= Named list() - attr(*, "class")= chr [1:2] "Globals" "list" > assert_identical_sets(names(globals_i), character(0)) > where <- attr(globals_i, "where") > stopifnot(length(where) == length(globals_i), identical(where, + setNames(list(), character(0)))) > globals_i <- globalsOf(function(x) x[1] <- 0) > print(globals_i) $`<-` .Primitive("<-") $`[` .Primitive("[") $`[<-` .Primitive("[<-") attr(,"where") attr(,"where")$`<-` attr(,"where")$`[` attr(,"where")$`[<-` attr(,"class") [1] "Globals" "list" > globals_i <- cleanup(globals_i) > str(globals_i) Named list() - attr(*, "where")= Named list() - attr(*, "class")= chr [1:2] "Globals" "list" > assert_identical_sets(names(globals_i), character(0)) > where <- attr(globals_i, "where") > stopifnot(length(where) == length(globals_i), identical(where, + setNames(list(), character(0)))) > globals_i <- globalsOf(function(x) a <- x$a) > print(globals_i) $`<-` .Primitive("<-") $`$` .Primitive("$") attr(,"where") attr(,"where")$`<-` attr(,"where")$`$` attr(,"class") [1] "Globals" "list" > globals_i <- cleanup(globals_i) > str(globals_i) Named list() - attr(*, "where")= Named list() - attr(*, "class")= chr [1:2] "Globals" "list" > assert_identical_sets(names(globals_i), character(0)) > where <- attr(globals_i, "where") > stopifnot(length(where) == length(globals_i), identical(where, + setNames(list(), character(0)))) > globals_i <- globalsOf(function(...) args <- list(...)) > print(globals_i) $`<-` .Primitive("<-") $list function (...) .Primitive("list") attr(,"where") attr(,"where")$`<-` attr(,"where")$list attr(,"class") [1] "Globals" "list" > globals_i <- cleanup(globals_i) > str(globals_i) Named list() - attr(*, "where")= Named list() - attr(*, "class")= chr [1:2] "Globals" "list" > assert_identical_sets(names(globals_i), character(0)) > where <- attr(globals_i, "where") > stopifnot(length(where) == length(globals_i), identical(where, + setNames(list(), character(0)))) > x <- 1 > globals_i <- globalsOf({ + function(x) x + x + }, substitute = TRUE) > print(globals_i) $`{` .Primitive("{") $x [1] 1 attr(,"where") attr(,"where")$`{` attr(,"where")$x attr(,"class") [1] "Globals" "list" > globals_i <- cleanup(globals_i) > str(globals_i) List of 1 $ x: num 1 - attr(*, "where")=List of 1 ..$ x: - attr(*, "class")= chr [1:2] "Globals" "list" > assert_identical_sets(names(globals_i), "x") > where <- attr(globals_i, "where") > stopifnot(length(where) == length(globals_i)) > message(" ** globalsOf() w/ globals in functions:") ** globalsOf() w/ globals in functions: > a <- 1 > bar <- function(x) x - a > foo <- function(x) bar(x) > for (method in c("ordered", "conservative", "liberal")) { + globals <- globalsOf({ + foo(3) + }, substitute = TRUE, method = method, .... [TRUNCATED] List of 1 $ foo:function (x) - attr(*, "where")=List of 1 ..$ foo: - attr(*, "class")= chr [1:2] "Globals" "list" List of 3 $ foo:function (x) $ bar:function (x) $ a : num 1 - attr(*, "where")=List of 3 ..$ foo: ..$ bar: ..$ a : - attr(*, "class")= chr [1:2] "Globals" "list" List of 3 $ foo:function (x) $ bar:function (x) $ a : num 1 - attr(*, "where")=List of 3 ..$ foo: ..$ bar: ..$ a : - attr(*, "class")= chr [1:2] "Globals" "list" List of 1 $ foo:function (x) - attr(*, "where")=List of 1 ..$ foo: - attr(*, "class")= chr [1:2] "Globals" "list" List of 3 $ foo:function (x) $ bar:function (x) $ a : num 1 - attr(*, "where")=List of 3 ..$ foo: ..$ bar: ..$ a : - attr(*, "class")= chr [1:2] "Globals" "list" List of 3 $ foo:function (x) $ bar:function (x) $ a : num 1 - attr(*, "where")=List of 3 ..$ foo: ..$ bar: ..$ a : - attr(*, "class")= chr [1:2] "Globals" "list" List of 1 $ foo:function (x) - attr(*, "where")=List of 1 ..$ foo: - attr(*, "class")= chr [1:2] "Globals" "list" List of 3 $ foo:function (x) $ bar:function (x) $ a : num 1 - attr(*, "where")=List of 3 ..$ foo: ..$ bar: ..$ a : - attr(*, "class")= chr [1:2] "Globals" "list" List of 3 $ foo:function (x) $ bar:function (x) $ a : num 1 - attr(*, "where")=List of 3 ..$ foo: ..$ bar: ..$ a : - attr(*, "class")= chr [1:2] "Globals" "list" > message(" ** globalsOf() w/ recursive functions:") ** globalsOf() w/ recursive functions: > f <- function() Recall() > globals <- globalsOf(f) > str(globals) List of 1 $ Recall:function (...) - attr(*, "where")=List of 1 ..$ Recall: - attr(*, "class")= chr [1:2] "Globals" "list" > f <- function() f() > globals <- globalsOf(f) > str(globals) List of 1 $ f:function () - attr(*, "where")=List of 1 ..$ f: - attr(*, "class")= chr [1:2] "Globals" "list" > f <- function() g() > g <- function() f() > globals_f <- globalsOf(f) > str(globals_f) List of 2 $ g:function () $ f:function () - attr(*, "where")=List of 2 ..$ g: ..$ f: - attr(*, "class")= chr [1:2] "Globals" "list" > globals_g <- globalsOf(g) > str(globals_g) List of 2 $ f:function () $ g:function () - attr(*, "where")=List of 2 ..$ f: ..$ g: - attr(*, "class")= chr [1:2] "Globals" "list" > globals_f <- globals_f[order(names(globals_f))] > globals_g <- globals_g[order(names(globals_g))] > stopifnot(identical(globals_g, globals_f)) > message("*** globalsOf() ... DONE") *** globalsOf() ... DONE > message("*** Subsetting of Globals:") *** Subsetting of Globals: > expr <- exprs$A > globals_l <- globalsOf(expr, method = "liberal") > globals_s <- globals_l[-1] > stopifnot(length(globals_s) == length(globals_l) - + 1) > stopifnot(identical(class(globals_s), class(globals_l))) > where_l <- attr(globals_l, "where") > where_s <- attr(globals_s, "where") > stopifnot(length(where_s) == length(where_l) - 1) > stopifnot(identical(where_s, where_l[-1])) > message("*** cleanup() & packagesOf():") *** cleanup() & packagesOf(): > expr <- exprs$A > globals <- globalsOf(expr, method = "conservative") > str(globals) List of 5 $ { :.Primitive("{") $ <-:.Primitive("<-") $ c : num 3 $ d : NULL $ + :function (e1, e2) - attr(*, "where")=List of 5 ..$ { : ..$ <-: ..$ c : ..$ d : ..$ + : - attr(*, "class")= chr [1:2] "Globals" "list" > assert_identical_sets(names(globals), c("{", "<-", + "c", "d", "+")) > globals <- as.Globals(globals) > str(globals) List of 5 $ { :.Primitive("{") $ <-:.Primitive("<-") $ c : num 3 $ d : NULL $ + :function (e1, e2) - attr(*, "where")=List of 5 ..$ { : ..$ <-: ..$ c : ..$ d : ..$ + : - attr(*, "class")= chr [1:2] "Globals" "list" > assert_identical_sets(names(globals), c("{", "<-", + "c", "d", "+")) > globals <- as.Globals(unclass(globals)) > str(globals) List of 5 $ { :.Primitive("{") $ <-:.Primitive("<-") $ c : num 3 $ d : NULL $ + :function (e1, e2) - attr(*, "where")=List of 5 ..$ { : ..$ <-: ..$ c : ..$ d : ..$ + : - attr(*, "class")= chr [1:2] "Globals" "list" > assert_identical_sets(names(globals), c("{", "<-", + "c", "d", "+")) > pkgs <- packagesOf(globals) > print(pkgs) [1] "base" > stopifnot(length(pkgs) == 1, identical(pkgs, c("base"))) > globals <- cleanup(globals) > str(globals) List of 2 $ c: num 3 $ d: NULL - attr(*, "where")=List of 2 ..$ c: ..$ d: - attr(*, "class")= chr [1:2] "Globals" "list" > assert_identical_sets(names(globals), c("c", "d")) > pkgs <- packagesOf(globals) > print(pkgs) character(0) > stopifnot(length(pkgs) == 0) > globals <- globalsOf(quote(pi)) > stopifnot(length(globals) == 1, identical(names(globals), + "pi")) > pkgs <- packagesOf(globals) > print(pkgs) [1] "base" > stopifnot(length(pkgs) == 1, identical(pkgs, c("base"))) > message("*** globalsOf() and package functions:") *** globalsOf() and package functions: > foo <- globals::Globals > expr <- exprs$C > globals <- globalsOf(expr, recursive = FALSE) > str(globals) List of 3 $ { :.Primitive("{") $ foo :function (object = list(), ...) $ list:function (...) - attr(*, "where")=List of 3 ..$ { : ..$ foo : ..$ list: - attr(*, "class")= chr [1:2] "Globals" "list" > assert_identical_sets(names(globals), c("{", "foo", + "list")) > where <- attr(globals, "where") > stopifnot(length(where) == length(globals)) > if (!covr) stopifnot(identical(where$`{`, baseenv()), + identical(where$foo, globalenv()), identical(where$list, + baseenv())) > globals <- cleanup(globals) > str(globals) List of 1 $ foo:function (object = list(), ...) - attr(*, "where")=List of 1 ..$ foo: - attr(*, "class")= chr [1:2] "Globals" "list" > assert_identical_sets(names(globals), c("foo")) > pkgs <- packagesOf(globals) > stopifnot(pkgs == "globals") > message("*** globalsOf() and core-package functions:") *** globalsOf() and core-package functions: > sample2 <- base::sample > sum2 <- base::sum > expr <- exprs$D > globals <- globalsOf(expr, recursive = FALSE) > str(globals) List of 8 $ { :.Primitive("{") $ <- :.Primitive("<-") $ sample :function (x, size, replace = FALSE, prob = NULL) $ sum :function (..., na.rm = FALSE) $ sample2 :function (x, size, replace = FALSE, prob = NULL) $ sum2 :function (..., na.rm = FALSE) $ sessionInfo :function (package = NULL) $ isNamespaceLoaded:function (name) - attr(*, "where")=List of 8 ..$ { : ..$ <- : ..$ sample : ..$ sum : ..$ sample2 : ..$ sum2 : ..$ sessionInfo : .. ..- attr(*, "name")= chr "package:utils" .. ..- attr(*, "path")= chr "D:/RCompile/recent/R/library/utils" ..$ isNamespaceLoaded: - attr(*, "class")= chr [1:2] "Globals" "list" > assert_identical_sets(names(globals), c("{", "<-", + "sample", "sample2", "sessionInfo", "sum", "sum2", "isNamespaceLoaded")) > where <- attr(globals, "where") > stopifnot(length(where) == length(globals)) > if (!covr) stopifnot(identical(where$`<-`, baseenv()), + identical(where$sample, baseenv()), identical(where$sample2, + globalenv())) > globals <- cleanup(globals, drop = "primitives") > str(globals) List of 5 $ sample :function (x, size, replace = FALSE, prob = NULL) $ sample2 :function (x, size, replace = FALSE, prob = NULL) $ sum2 :function (..., na.rm = FALSE) $ sessionInfo :function (package = NULL) $ isNamespaceLoaded:function (name) - attr(*, "where")=List of 5 ..$ sample : ..$ sample2 : ..$ sum2 : ..$ sessionInfo : .. ..- attr(*, "name")= chr "package:utils" .. ..- attr(*, "path")= chr "D:/RCompile/recent/R/library/utils" ..$ isNamespaceLoaded: - attr(*, "class")= chr [1:2] "Globals" "list" > assert_identical_sets(names(globals), c("sample", + "sample2", "sum2", "sessionInfo", "isNamespaceLoaded")) > globals <- cleanup(globals, drop = "internals") > str(globals) List of 4 $ sample :function (x, size, replace = FALSE, prob = NULL) $ sample2 :function (x, size, replace = FALSE, prob = NULL) $ sum2 :function (..., na.rm = FALSE) $ sessionInfo:function (package = NULL) - attr(*, "where")=List of 4 ..$ sample : ..$ sample2 : ..$ sum2 : ..$ sessionInfo: .. ..- attr(*, "name")= chr "package:utils" .. ..- attr(*, "path")= chr "D:/RCompile/recent/R/library/utils" - attr(*, "class")= chr [1:2] "Globals" "list" > assert_identical_sets(names(globals), c("sample", + "sample2", "sum2", "sessionInfo")) > globals <- cleanup(globals) > str(globals) List of 2 $ sample2:function (x, size, replace = FALSE, prob = NULL) $ sum2 :function (..., na.rm = FALSE) - attr(*, "where")=List of 2 ..$ sample2: ..$ sum2 : - attr(*, "class")= chr [1:2] "Globals" "list" > assert_identical_sets(names(globals), c("sample2", + "sum2")) > where <- attr(globals, "where") > stopifnot(length(where) == length(globals)) > if (!covr) stopifnot(identical(where$sample2, globalenv())) > message("*** globalsOf() - exceptions ...") *** globalsOf() - exceptions ... > rm(list = "a") > res <- try({ + globals <- globalsOf({ + x <- a + }, substitute = TRUE, mustExist = TRUE) + }, silent = TRUE) > stopifnot(inherits(res, "try-error")) > rm(list = c("b", "c", "d", "e"), inherits = FALSE) > res <- try({ + globals <- globalsOf({ + x <- a + b + }, substitute = TRUE, mustExist = TRUE) + }, silent = TRUE) > stopifnot(inherits(res, "try-error")) > message("*** globalsOf() - exceptions ... DONE") *** globalsOf() - exceptions ... DONE > message("*** globalsOf() - locals option via env var ...") *** globalsOf() - locals option via env var ... > a_opt <- 100 > f_opt <- local({ + local_var <- 42 + function() local_var + a_opt + }) > globals_t <- globalsOf(quote(f_opt), locals = TRUE) > str(globals_t) List of 4 $ f_opt :function () $ + :function (e1, e2) $ local_var: num 42 $ a_opt : num 100 - attr(*, "where")=List of 4 ..$ f_opt : ..$ + : ..$ local_var: ..$ a_opt : - attr(*, "class")= chr [1:2] "Globals" "list" > stopifnot("local_var" %in% names(globals_t)) > globals_f <- globalsOf(quote(f_opt), locals = FALSE) > str(globals_f) List of 3 $ f_opt:function () $ + :function (e1, e2) $ a_opt: num 100 - attr(*, "where")=List of 3 ..$ f_opt: ..$ + : ..$ a_opt: - attr(*, "class")= chr [1:2] "Globals" "list" > stopifnot(!"local_var" %in% names(globals_f)) > message("*** globalsOf() - locals option via env var ... DONE") *** globalsOf() - locals option via env var ... DONE > message("*** globalsOf() - unlist = FALSE ...") *** globalsOf() - unlist = FALSE ... > a_unl <- 1 > b_unl <- 2 > expr <- quote({ + a_unl + b_unl + }) > globals_u <- globalsOf(expr, unlist = FALSE, mustExist = FALSE) > str(globals_u) List of 4 $ { :.Primitive("{") $ + :function (e1, e2) $ a_unl: num 1 $ b_unl: num 2 - attr(*, "where")=List of 4 ..$ { : ..$ + : ..$ a_unl: ..$ b_unl: - attr(*, "class")= chr [1:2] "Globals" "list" > stopifnot(length(globals_u) > 0) > message("*** globalsOf() - unlist = FALSE ... DONE") *** globalsOf() - unlist = FALSE ... DONE > message("*** globalsOf() - debug mode ...") *** globalsOf() - debug mode ... > a_dbg <- 1 > oopts <- options(globals.debug = TRUE) > globals_dbg <- globalsOf(quote(a_dbg + 1), mustExist = FALSE) [08:09:55.915] globalsOf(..., method = 'ordered', mustExist = FALSE, unlist = TRUE, recursive = TRUE) ... [08:09:55.917] | findGlobals(..., dotdotdot = 'warning', method = 'ordered', unlist = TRUE) ... [08:09:55.917] | : workaround 'codetools' bug #16 [08:09:55.918] | : globals found: [2] '+', 'a_dbg' [08:09:55.919] | findGlobals(..., dotdotdot = 'warning', method = 'ordered', unlist = TRUE) ... done [08:09:55.919] | preliminary globals (by name): [2] '+', 'a_dbg' [08:09:55.920] | globalsByName(<"+", "a_dbg"> [n=2], mustExist = FALSE) ... [08:09:55.920] | : search from environment: 'R_GlobalEnv' [08:09:55.921] | : dotdotdots: [08:09:55.921] | : locating #1 ('+') [08:09:55.922] | : where('+', where = -1, envir = 'R_GlobalEnv', mode = 'any', inherits = TRUE) ... [08:09:55.922] | : . searching 'R_GlobalEnv': 'a_dbg', 'a_opt', 'a_unl', ..., 'x' [08:09:55.923] | : . searching 'globals': 'Globals', 'as.Globals', 'cleanup', ..., 'walkAST' [08:09:55.923] | : . searching 'testme': 'as_function', 'assert_identical_sets', 'covr', ..., 'worker_label' [08:09:55.924] | : . searching 'stats': '.MFclass', '.checkMFClasses', '.getXlevels', ..., 'xtabs' [08:09:55.925] | : . searching 'graphics': '.filled.contour', 'Axis', 'abline', ..., 'yinch' [08:09:55.925] | : . searching 'grDevices': '.axisPars', '.clipPath', '.defineGroup', ..., 'xyz.coords' [08:09:55.926] | : . searching 'utils': '.AtNames', '.DollarNames', '.RtangleCodeLabel', ..., 'zip.unpack' [08:09:55.927] | : . searching 'datasets': 'AirPassengers', 'BJsales', 'BJsales.lead', ..., 'women' [08:09:55.927] | : . searching 'methods': '.EmptyPrimitiveSkeletons', '.OldClassesList', '.S4methods', ..., 'validSlotNames' [08:09:55.928] | : . searching 'Autoloads': '.Autoloaded' [08:09:55.929] | : . searching 'base': '!', '!.hexmode', '!.octmode', ..., '~' [08:09:55.931] | : . + found in location: 'base' [08:09:55.932] | : where('+', where = -1, envir = 'R_GlobalEnv', mode = 'any', inherits = TRUE) ... done [08:09:55.932] | : + found in environment: 'base' [08:09:55.933] | : locating #2 ('a_dbg') [08:09:55.933] | : where('a_dbg', where = -1, envir = 'R_GlobalEnv', mode = 'any', inherits = TRUE) ... [08:09:55.934] | : . searching 'R_GlobalEnv': 'a_dbg', 'a_opt', 'a_unl', ..., 'x' [08:09:55.935] | : . + found in location: 'R_GlobalEnv' [08:09:55.935] | : where('a_dbg', where = -1, envir = 'R_GlobalEnv', mode = 'any', inherits = TRUE) ... done [08:09:55.935] | : + found in environment: 'R_GlobalEnv' [08:09:55.936] | : Globals collected: [08:09:55.936] | : List of 2 [08:09:55.936] | : $ + :function (e1, e2) [08:09:55.936] | : $ a_dbg: num 1 [08:09:55.936] | : - attr(*, "where")=List of 2 [08:09:55.936] | : ..$ + : [08:09:55.936] | : ..$ a_dbg: [08:09:55.936] | : - attr(*, "class")= chr [1:2] "Globals" "list" [08:09:55.940] | globalsByName(<"+", "a_dbg"> [n=2], mustExist = FALSE) ... done [08:09:55.940] | preliminary globals (by value): [2] '+', 'a_dbg' [08:09:55.941] | recursive scan of preliminary globals ... [08:09:55.941] | : subset of globals to be scanned (not in loaded namespaces): [1] 'a_dbg' [08:09:55.942] | : subset of globals to be scanned: [0] [08:09:55.942] | recursive scan of preliminary globals ... done [08:09:55.943] | globals found: [2] '+', 'a_dbg' [08:09:55.943] globalsOf(..., method = 'ordered', mustExist = FALSE, unlist = TRUE, recursive = TRUE) ... done > stopifnot("a_dbg" %in% names(globals_dbg)) > globals_dbg2 <- globalsOf(quote(a_dbg + 1), method = c("ordered", + "dfs"), mustExist = FALSE) [08:09:55.944] globalsOf(..., method = c('ordered', 'dfs'), mustExist = FALSE, unlist = TRUE, recursive = TRUE) ... [08:09:55.945] | findGlobals(..., dotdotdot = 'warning', method = c('ordered', 'dfs'), unlist = TRUE) ... [08:09:55.945] | : findGlobals(..., dotdotdot = 'warning', method = 'ordered', unlist = TRUE) ... [08:09:55.946] | : . workaround 'codetools' bug #16 [08:09:55.946] | : . globals found: [2] '+', 'a_dbg' [08:09:55.947] | : findGlobals(..., dotdotdot = 'warning', method = 'ordered', unlist = TRUE) ... done [08:09:55.947] | : findGlobals(..., dotdotdot = 'warning', method = 'dfs', unlist = TRUE) ... [08:09:55.951] | : . globals found: [2] '+', 'a_dbg' [08:09:55.951] | : findGlobals(..., dotdotdot = 'warning', method = 'dfs', unlist = TRUE) ... done [08:09:55.952] | : Globals found by per method: [08:09:55.952] | : 'ordered': '+', 'a_dbg' [delta: ] [08:09:55.953] | : 'dfs': '+', 'a_dbg' [delta: ] [08:09:55.953] | findGlobals(..., dotdotdot = 'warning', method = c('ordered', 'dfs'), unlist = TRUE) ... done [08:09:55.954] | preliminary globals (by name): [2] '+', 'a_dbg' [08:09:55.954] | globalsByName(<"+", "a_dbg"> [n=2], mustExist = FALSE) ... [08:09:55.955] | : search from environment: 'R_GlobalEnv' [08:09:55.955] | : dotdotdots: [08:09:55.956] | : locating #1 ('+') [08:09:55.956] | : where('+', where = -1, envir = 'R_GlobalEnv', mode = 'any', inherits = TRUE) ... [08:09:55.957] | : . searching 'R_GlobalEnv': 'a_dbg', 'a_opt', 'a_unl', ..., 'x' [08:09:55.958] | : . searching 'globals': 'Globals', 'as.Globals', 'cleanup', ..., 'walkAST' [08:09:55.958] | : . searching 'testme': 'as_function', 'assert_identical_sets', 'covr', ..., 'worker_label' [08:09:55.959] | : . searching 'stats': '.MFclass', '.checkMFClasses', '.getXlevels', ..., 'xtabs' [08:09:55.960] | : . searching 'graphics': '.filled.contour', 'Axis', 'abline', ..., 'yinch' [08:09:55.960] | : . searching 'grDevices': '.axisPars', '.clipPath', '.defineGroup', ..., 'xyz.coords' [08:09:55.961] | : . searching 'utils': '.AtNames', '.DollarNames', '.RtangleCodeLabel', ..., 'zip.unpack' [08:09:55.962] | : . searching 'datasets': 'AirPassengers', 'BJsales', 'BJsales.lead', ..., 'women' [08:09:55.962] | : . searching 'methods': '.EmptyPrimitiveSkeletons', '.OldClassesList', '.S4methods', ..., 'validSlotNames' [08:09:55.963] | : . searching 'Autoloads': '.Autoloaded' [08:09:55.964] | : . searching 'base': '!', '!.hexmode', '!.octmode', ..., '~' [08:09:55.966] | : . + found in location: 'base' [08:09:55.967] | : where('+', where = -1, envir = 'R_GlobalEnv', mode = 'any', inherits = TRUE) ... done [08:09:55.967] | : + found in environment: 'base' [08:09:55.968] | : locating #2 ('a_dbg') [08:09:55.968] | : where('a_dbg', where = -1, envir = 'R_GlobalEnv', mode = 'any', inherits = TRUE) ... [08:09:55.969] | : . searching 'R_GlobalEnv': 'a_dbg', 'a_opt', 'a_unl', ..., 'x' [08:09:55.969] | : . + found in location: 'R_GlobalEnv' [08:09:55.970] | : where('a_dbg', where = -1, envir = 'R_GlobalEnv', mode = 'any', inherits = TRUE) ... done [08:09:55.970] | : + found in environment: 'R_GlobalEnv' [08:09:55.971] | : Globals collected: [08:09:55.971] | : List of 2 [08:09:55.971] | : $ + :function (e1, e2) [08:09:55.971] | : $ a_dbg: num 1 [08:09:55.971] | : - attr(*, "where")=List of 2 [08:09:55.971] | : ..$ + : [08:09:55.971] | : ..$ a_dbg: [08:09:55.971] | : - attr(*, "class")= chr [1:2] "Globals" "list" [08:09:55.975] | globalsByName(<"+", "a_dbg"> [n=2], mustExist = FALSE) ... done [08:09:55.976] | preliminary globals (by value): [2] '+', 'a_dbg' [08:09:55.976] | recursive scan of preliminary globals ... [08:09:55.977] | : subset of globals to be scanned (not in loaded namespaces): [1] 'a_dbg' [08:09:55.978] | : subset of globals to be scanned: [0] [08:09:55.978] | recursive scan of preliminary globals ... done [08:09:55.979] | globals found: [2] '+', 'a_dbg' [08:09:55.979] globalsOf(..., method = c('ordered', 'dfs'), mustExist = FALSE, unlist = TRUE, recursive = TRUE) ... done > stopifnot("a_dbg" %in% names(globals_dbg2)) > options(oopts) > message("*** globalsOf() - debug mode ... DONE") *** globalsOf() - debug mode ... DONE > message("*** globalsOf() - recursive with nested closures ...") *** globalsOf() - recursive with nested closures ... > outer_val <- 100 > inner_helper <- function(x) x + outer_val > outer_helper <- function(y) inner_helper(y) > globals_rec <- globalsOf(quote(outer_helper(1)), recursive = TRUE, + mustExist = FALSE) > stopifnot("outer_helper" %in% names(globals_rec)) > stopifnot("inner_helper" %in% names(globals_rec)) > stopifnot("outer_val" %in% names(globals_rec)) > oopts <- options(globals.debug = TRUE) > globals_rec_d <- globalsOf(quote(outer_helper(1)), + recursive = TRUE, mustExist = FALSE) [08:09:55.983] globalsOf(..., method = 'ordered', mustExist = FALSE, unlist = TRUE, recursive = TRUE) ... [08:09:55.983] | findGlobals(..., dotdotdot = 'warning', method = 'ordered', unlist = TRUE) ... [08:09:55.984] | : workaround 'codetools' bug #16 [08:09:55.985] | : globals found: [1] 'outer_helper' [08:09:55.985] | findGlobals(..., dotdotdot = 'warning', method = 'ordered', unlist = TRUE) ... done [08:09:55.986] | preliminary globals (by name): [1] 'outer_helper' [08:09:55.986] | globalsByName("outer_helper", mustExist = FALSE) ... [08:09:55.987] | : search from environment: 'R_GlobalEnv' [08:09:55.987] | : dotdotdots: [08:09:55.988] | : locating #1 ('outer_helper') [08:09:55.988] | : where('outer_helper', where = -1, envir = 'R_GlobalEnv', mode = 'any', inherits = TRUE) ... [08:09:55.989] | : . searching 'R_GlobalEnv': 'a_dbg', 'a_opt', 'a_unl', ..., 'x' [08:09:55.989] | : . + found in location: 'R_GlobalEnv' [08:09:55.990] | : where('outer_helper', where = -1, envir = 'R_GlobalEnv', mode = 'any', inherits = TRUE) ... done [08:09:55.990] | : + found in environment: 'R_GlobalEnv' [08:09:55.991] | : Globals collected: [08:09:55.991] | : List of 1 [08:09:55.991] | : $ outer_helper:function (y) [08:09:55.991] | : - attr(*, "where")=List of 1 [08:09:55.991] | : ..$ outer_helper: [08:09:55.991] | : - attr(*, "class")= chr [1:2] "Globals" "list" [08:09:55.993] | globalsByName("outer_helper", mustExist = FALSE) ... done [08:09:55.994] | preliminary globals (by value): [1] 'outer_helper' [08:09:55.994] | recursive scan of preliminary globals ... [08:09:55.995] | : subset of globals to be scanned (not in loaded namespaces): [1] 'outer_helper' [08:09:55.995] | : subset of globals to be scanned: [1] 'outer_helper' [08:09:55.996] | : + scanning global #1 ('outer_helper') ... [08:09:55.996] | : globalsOf(..., method = 'ordered', mustExist = FALSE, unlist = TRUE, recursive = TRUE) ... [08:09:55.997] | : . findGlobals(..., dotdotdot = 'warning', method = 'ordered', unlist = TRUE) ... [08:09:55.997] | : . ' workaround 'codetools' bug #16 [08:09:55.998] | : . ' globals found: [1] 'inner_helper' [08:09:55.999] | : . findGlobals(..., dotdotdot = 'warning', method = 'ordered', unlist = TRUE) ... done [08:09:55.999] | : . preliminary globals (by name): [1] 'inner_helper' [08:09:56.000] | : . globalsByName("inner_helper", mustExist = FALSE) ... [08:09:56.000] | : . ' search from environment: 'R_GlobalEnv' [08:09:56.001] | : . ' dotdotdots: [08:09:56.001] | : . ' locating #1 ('inner_helper') [08:09:56.002] | : . ' where('inner_helper', where = -1, envir = 'R_GlobalEnv', mode = 'any', inherits = TRUE) ... [08:09:56.002] | : . ' , searching 'R_GlobalEnv': 'a_dbg', 'a_opt', 'a_unl', ..., 'x' [08:09:56.003] | : . ' , + found in location: 'R_GlobalEnv' [08:09:56.003] | : . ' where('inner_helper', where = -1, envir = 'R_GlobalEnv', mode = 'any', inherits = TRUE) ... done [08:09:56.004] | : . ' + found in environment: 'R_GlobalEnv' [08:09:56.004] | : . ' Globals collected: [08:09:56.005] | : . ' List of 1 [08:09:56.005] | : . ' $ inner_helper:function (x) [08:09:56.005] | : . ' - attr(*, "where")=List of 1 [08:09:56.005] | : . ' ..$ inner_helper: [08:09:56.005] | : . ' - attr(*, "class")= chr [1:2] "Globals" "list" [08:09:56.007] | : . globalsByName("inner_helper", mustExist = FALSE) ... done [08:09:56.007] | : . preliminary globals (by value): [1] 'inner_helper' [08:09:56.008] | : . recursive scan of preliminary globals ... [08:09:56.008] | : . ' subset of globals to be scanned (not in loaded namespaces): [1] 'inner_helper' [08:09:56.009] | : . ' subset of globals to be scanned: [1] 'inner_helper' [08:09:56.010] | : . ' + scanning global #1 ('inner_helper') ... [08:09:56.010] | : . ' globalsOf(..., method = 'ordered', mustExist = FALSE, unlist = TRUE, recursive = TRUE) ... [08:09:56.011] | : . ' , findGlobals(..., dotdotdot = 'warning', method = 'ordered', unlist = TRUE) ... [08:09:56.011] | : . ' , ; workaround 'codetools' bug #16 [08:09:56.012] | : . ' , ; globals found: [2] '+', 'outer_val' [08:09:56.013] | : . ' , findGlobals(..., dotdotdot = 'warning', method = 'ordered', unlist = TRUE) ... done [08:09:56.013] | : . ' , preliminary globals (by name): [2] '+', 'outer_val' [08:09:56.014] | : . ' , globalsByName(<"+", "outer_val"> [n=2], mustExist = FALSE) ... [08:09:56.014] | : . ' , ; search from environment: 'R_GlobalEnv' [08:09:56.015] | : . ' , ; dotdotdots: [08:09:56.015] | : . ' , ; locating #1 ('+') [08:09:56.016] | : . ' , ; where('+', where = -1, envir = 'R_GlobalEnv', mode = 'any', inherits = TRUE) ... [08:09:56.016] | : . ' , ; ` searching 'R_GlobalEnv': 'a_dbg', 'a_opt', 'a_unl', ..., 'x' [08:09:56.017] | : . ' , ; ` searching 'globals': 'Globals', 'as.Globals', 'cleanup', ..., 'walkAST' [08:09:56.017] | : . ' , ; ` searching 'testme': 'as_function', 'assert_identical_sets', 'covr', ..., 'worker_label' [08:09:56.018] | : . ' , ; ` searching 'stats': '.MFclass', '.checkMFClasses', '.getXlevels', ..., 'xtabs' [08:09:56.019] | : . ' , ; ` searching 'graphics': '.filled.contour', 'Axis', 'abline', ..., 'yinch' [08:09:56.019] | : . ' , ; ` searching 'grDevices': '.axisPars', '.clipPath', '.defineGroup', ..., 'xyz.coords' [08:09:56.020] | : . ' , ; ` searching 'utils': '.AtNames', '.DollarNames', '.RtangleCodeLabel', ..., 'zip.unpack' [08:09:56.021] | : . ' , ; ` searching 'datasets': 'AirPassengers', 'BJsales', 'BJsales.lead', ..., 'women' [08:09:56.021] | : . ' , ; ` searching 'methods': '.EmptyPrimitiveSkeletons', '.OldClassesList', '.S4methods', ..., 'validSlotNames' [08:09:56.022] | : . ' , ; ` searching 'Autoloads': '.Autoloaded' [08:09:56.023] | : . ' , ; ` searching 'base': '!', '!.hexmode', '!.octmode', ..., '~' [08:09:56.025] | : . ' , ; ` + found in location: 'base' [08:09:56.026] | : . ' , ; where('+', where = -1, envir = 'R_GlobalEnv', mode = 'any', inherits = TRUE) ... done [08:09:56.026] | : . ' , ; + found in environment: 'base' [08:09:56.027] | : . ' , ; locating #2 ('outer_val') [08:09:56.027] | : . ' , ; where('outer_val', where = -1, envir = 'R_GlobalEnv', mode = 'any', inherits = TRUE) ... [08:09:56.028] | : . ' , ; ` searching 'R_GlobalEnv': 'a_dbg', 'a_opt', 'a_unl', ..., 'x' [08:09:56.029] | : . ' , ; ` + found in location: 'R_GlobalEnv' [08:09:56.029] | : . ' , ; where('outer_val', where = -1, envir = 'R_GlobalEnv', mode = 'any', inherits = TRUE) ... done [08:09:56.029] | : . ' , ; + found in environment: 'R_GlobalEnv' [08:09:56.030] | : . ' , ; Globals collected: [08:09:56.030] | : . ' , ; List of 2 [08:09:56.030] | : . ' , ; $ + :function (e1, e2) [08:09:56.030] | : . ' , ; $ outer_val: num 100 [08:09:56.030] | : . ' , ; - attr(*, "where")=List of 2 [08:09:56.030] | : . ' , ; ..$ + : [08:09:56.030] | : . ' , ; ..$ outer_val: [08:09:56.030] | : . ' , ; - attr(*, "class")= chr [1:2] "Globals" "list" [08:09:56.034] | : . ' , globalsByName(<"+", "outer_val"> [n=2], mustExist = FALSE) ... done [08:09:56.034] | : . ' , preliminary globals (by value): [2] '+', 'outer_val' [08:09:56.035] | : . ' , recursive scan of preliminary globals ... [08:09:56.035] | : . ' , ; subset of globals to be scanned (not in loaded namespaces): [1] 'outer_val' [08:09:56.036] | : . ' , ; subset of globals to be scanned: [0] [08:09:56.036] | : . ' , recursive scan of preliminary globals ... done [08:09:56.037] | : . ' , globals found: [2] '+', 'outer_val' [08:09:56.037] | : . ' globalsOf(..., method = 'ordered', mustExist = FALSE, unlist = TRUE, recursive = TRUE) ... done [08:09:56.038] | : . ' updated set of globals found: [3] 'inner_helper', '+', 'outer_val' [08:09:56.038] | : . recursive scan of preliminary globals ... done [08:09:56.039] | : . globals found: [3] 'inner_helper', '+', 'outer_val' [08:09:56.039] | : globalsOf(..., method = 'ordered', mustExist = FALSE, unlist = TRUE, recursive = TRUE) ... done [08:09:56.040] | : updated set of globals found: [4] 'outer_helper', 'inner_helper', '+', 'outer_val' [08:09:56.040] | recursive scan of preliminary globals ... done [08:09:56.041] | globals found: [4] 'outer_helper', 'inner_helper', '+', 'outer_val' [08:09:56.041] globalsOf(..., method = 'ordered', mustExist = FALSE, unlist = TRUE, recursive = TRUE) ... done > stopifnot("outer_helper" %in% names(globals_rec_d)) > options(oopts) > message("*** globalsOf() - recursive with nested closures ... DONE") *** globalsOf() - recursive with nested closures ... DONE > message("*** globalsOf() - recursive, namespace closures ...") *** globalsOf() - recursive, namespace closures ... > globals_ns <- globalsOf(quote(base::sum(1:3)), recursive = TRUE, + mustExist = FALSE) > message("*** globalsOf() - recursive, namespace closures ... DONE") *** globalsOf() - recursive, namespace closures ... DONE > message("*** globalsOf() - locals = FALSE with function ...") *** globalsOf() - locals = FALSE with function ... > outer_val2 <- 200 > f_locals <- local({ + local_var2 <- 42 + function() local_var2 + outer_val2 + }) > globals_lt <- globalsOf(quote(f_locals), locals = TRUE, + mustExist = FALSE) > stopifnot("local_var2" %in% names(globals_lt)) > globals_lf <- globalsOf(quote(f_locals), locals = FALSE, + mustExist = FALSE) > stopifnot(!"local_var2" %in% names(globals_lf)) > message("*** globalsOf() - locals = FALSE ... DONE") *** globalsOf() - locals = FALSE ... DONE > rm(list = c("a_dbg", "outer_val", "inner_helper", + "outer_helper", "outer_val2", "f_locals", "a_unl", "b_unl")) Sourcing 5 epilogue scripts ... 01/05 epilogue script 'D:/RCompile/CRANincoming/R-devel/lib/globals/testme/_epilogue/002.undo-state.R' Failed to undo environment variables: - Expected environment variables: [n=212] '!ExitCode', 'ALLUSERSPROFILE', 'APPDATA', ..., 'tempdirname' - Environment variables still there: [n=0] - Environment variables missing: [n=1] 'MAKEFLAGS' Differences environment variable by environment variable: 02/05 epilogue script 'D:/RCompile/CRANincoming/R-devel/lib/globals/testme/_epilogue/090.gc.R' 03/05 epilogue script 'D:/RCompile/CRANincoming/R-devel/lib/globals/testme/_epilogue/099.session_info.R' 04/05 epilogue script 'D:/RCompile/CRANincoming/R-devel/lib/globals/testme/_epilogue/995.detritus-connections.R' 05/05 epilogue script 'D:/RCompile/CRANincoming/R-devel/lib/globals/testme/_epilogue/999.detritus-files.R' Skipping, because path appears not to be an 'R CMD check' folder: 'D:/temp/2026_03_13_07_10_17_31522' Sourcing 5 epilogue scripts ... done Test time: user.self=0.4s, sys.self=0.03s, elapsed=0.4s, user.child=NAs, sys.child=NAs Test 'globalsOf' ... success > > proc.time() user system elapsed 0.53 0.06 0.57