R Under development (unstable) (2025-04-15 r88147 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-globalsByName.R > ## Don't edit - it was autogenerated by inst/testme/deploy.R > globals:::testme("globalsByName") Test 'globalsByName' ... 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-globalsByName.R' > library(globals) > message("*** globalsByName() ...") *** globalsByName() ... > globals_c <- globalsByName(c("{", "<-", "c", "d")) > str(globals_c) List of 4 $ { :.Primitive("{") $ <-:.Primitive("<-") $ c : num 3 $ d : NULL - attr(*, "where")=List of 4 ..$ { : ..$ <-: ..$ 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())) > foo <- globals::Globals > globals <- globalsByName(c("{", "foo", "list"), 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")) > globals <- cleanup(globals, drop = "internals") > 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") > myGlobals <- function(x, ...) { + globalsByName(c("a", "x", "...")) + } > globals <- myGlobals(x = 2, y = 3, z = 4) > str(globals) List of 3 $ a : num 0 $ x : num 2 $ ...:List of 2 ..$ y: num 3 ..$ z: num 4 ..- attr(*, "class")= chr [1:2] "DotDotDotList" "list" - attr(*, "where")=List of 3 ..$ a : ..$ x : ..$ ...: - attr(*, "class")= chr [1:2] "Globals" "list" > assert_identical_sets(names(globals), c("a", "x", + "...")) > assert_identical_sets(names(globals[["..."]]), c("y", + "z")) > myGlobals <- function(x, ...) { + globalsByName(c("a", "x", "..1", "..2")) + } > globals <- myGlobals(x = 2, y = 3, 4) > str(globals) List of 4 $ a : num 0 $ x : num 2 $ ..1:List of 1 ..$ : num 3 ..- attr(*, "class")= chr [1:2] "DotDotDotList" "list" $ ..2:List of 1 ..$ : num 4 ..- attr(*, "class")= chr [1:2] "DotDotDotList" "list" - attr(*, "where")=List of 4 ..$ a : ..$ x : ..$ ..1: ..$ ..2: - attr(*, "class")= chr [1:2] "Globals" "list" > assert_identical_sets(names(globals), c("a", "x", + "..1", "..2")) > stopifnot(globals[["..1"]] == 3, globals[["..2"]] == + 4) > myGlobals <- function(x, ...) { + globalsByName(c("a", "...", "x")) + } > globals <- myGlobals(x = 2, y = 3, z = 4) > str(globals) List of 3 $ a : num 0 $ ...:List of 2 ..$ y: num 3 ..$ z: num 4 ..- attr(*, "class")= chr [1:2] "DotDotDotList" "list" $ x : num 2 - attr(*, "where")=List of 3 ..$ a : ..$ ...: ..$ x : - attr(*, "class")= chr [1:2] "Globals" "list" > assert_identical_sets(names(globals), c("a", "x", + "...")) > assert_identical_sets(names(globals[["..."]]), c("y", + "z")) > myGlobals <- function(x, y, z = y) { + globalsByName(c("a", "x", "y", "z")) + } > globals <- myGlobals(x = 2, y = 3) > assert_identical_sets(names(globals), c("a", "x", + "y", "z")) > stopifnot(globals$y == 3, identical(globals$z, globals$y)) > globals <- myGlobals(x = 2, y = 3, z = 4) > assert_identical_sets(names(globals), c("a", "x", + "y", "z")) > stopifnot(globals$y == 3, globals$z == 4) > myGlobals <- function(x, ...) { + globalsByName(c("a", "x", "...")) + } > globals <- myGlobals(x = 2, y = 3) > assert_identical_sets(names(globals), c("a", "x", + "...")) > assert_identical_sets(names(globals[["..."]]), c("y")) > stopifnot(globals[["..."]]$y == 3) > globals <- myGlobals(x = 2, y = 3, z = 4) > assert_identical_sets(names(globals), c("a", "x", + "...")) > assert_identical_sets(names(globals[["..."]]), c("y", + "z")) > stopifnot(globals[["..."]]$y == 3, globals[["..."]]$z == + 4) > message("*** globalsByName() ... DONE") *** globalsByName() ... DONE 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=207] '!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/2025_04_16_07_20_17_20184' Sourcing 5 epilogue scripts ... done Test time: user.self=0.1s, sys.self=0.02s, elapsed=0.1s, user.child=NAs, sys.child=NAs Test 'globalsByName' ... success > > proc.time() user system elapsed 0.37 0.09 0.43