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-cleanup.R > ## Don't edit - it was autogenerated by inst/testme/deploy.R > globals:::testme("cleanup") Test 'cleanup' ... 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-cleanup.R' > library(globals) > message("*** cleanup() ...") *** cleanup() ... > message("- cleanup() with remapped base functions") - cleanup() with remapped base functions > globals <- list(my_fcn = function(x) x, identity = base::identity, + my_identity = base::identity) > expected <- c("my_fcn", "my_identity") > ns <- asNamespace("utils") > pkg <- as.environment("package:utils") > internals <- setdiff(ls(ns, all.names = TRUE), ls(pkg, + all.names = TRUE)) > internals <- grep("^print", internals, value = TRUE) > if (length(internals) > 0) { + name <- internals[1] + obj <- get(name, envir = ns, inherits = FALSE) + stopifnot(!exists(name, envir = p .... [TRUNCATED] > globals <- as.Globals(globals) > str(globals) List of 5 $ my_fcn :function (x) $ identity :function (x) $ my_identity :function (x) $ print.Bibtex :function (x, prefix = "", ...) $ my-print.Bibtex:function (x, prefix = "", ...) - attr(*, "where")=List of 5 ..$ my_fcn : ..$ identity : ..$ my_identity : ..$ print.Bibtex : ..$ my-print.Bibtex: - attr(*, "class")= chr [1:2] "Globals" "list" > globals <- cleanup(globals) > str(globals) List of 4 $ my_fcn :function (x) $ my_identity :function (x) $ print.Bibtex :function (x, prefix = "", ...) $ my-print.Bibtex:function (x, prefix = "", ...) - attr(*, "where")=List of 4 ..$ my_fcn : ..$ my_identity : ..$ print.Bibtex : ..$ my-print.Bibtex: - attr(*, "class")= chr [1:2] "Globals" "list" > assert_identical_sets(names(globals), expected) > message("- cleanup() with missing globals") - cleanup() with missing globals > rm(list = "b") > expr <- quote(a <- b) > print(expr) a <- b > globals <- globalsOf(expr, mustExist = FALSE) > str(globals) List of 2 $ <-:.Primitive("<-") $ b : NULL - attr(*, "where")=List of 2 ..$ <-: ..$ b : NULL - attr(*, "class")= chr [1:2] "Globals" "list" > stopifnot(identical(names(globals), c("<-", "b"))) > message("- cleanup(globals) with missing globals") - cleanup(globals) with missing globals > pruned <- cleanup(globals) > str(pruned) Named list() - attr(*, "where")= Named list() - attr(*, "class")= chr [1:2] "Globals" "list" > stopifnot(length(pruned) == 0) > message("- cleanup(globals, drop = 'missing') with missing globals") - cleanup(globals, drop = 'missing') with missing globals > pruned <- cleanup(globals, drop = "missing") > str(pruned) List of 1 $ <-:.Primitive("<-") - attr(*, "where")=List of 1 ..$ <-: - attr(*, "class")= chr [1:2] "Globals" "list" > stopifnot(identical(names(pruned), c("<-"))) > message("- cleanup(globals, drop = 'base-packages') with missing globals") - cleanup(globals, drop = 'base-packages') with missing globals > pruned <- cleanup(globals, drop = "base-packages") > str(pruned) List of 1 $ b: NULL - attr(*, "where")=List of 1 ..$ b: NULL - attr(*, "class")= chr [1:2] "Globals" "list" > stopifnot(identical(names(pruned), c("b"))) > message("*** cleanup() ... DONE") *** cleanup() ... 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.08s, sys.self=0.05s, elapsed=0.1s, user.child=NAs, sys.child=NAs Test 'cleanup' ... success > > proc.time() user system elapsed 0.28 0.12 0.39