R version 4.5.0 beta (2025-03-29 r88074 ucrt) -- "How About a Twenty-Six" 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. > message("*** Utility functions ...") *** Utility functions ... > > tests_root <- future.tests:::tests_root > assert_package <- future.tests:::assert_package > load_package <- future.tests:::load_package > attach_package <- future.tests:::attach_package > hpaste <- future.tests:::hpaste > is_covr <- future.tests:::is_covr > printf <- future.tests:::printf > mprintf <- future.tests:::mprintf > mprint <- future.tests:::mprint > mstr <- future.tests:::mstr > mdebug <- future.tests:::mdebug > parseCmdArgs <- future.tests:::parseCmdArgs > stop_if_not <- future.tests:::stop_if_not > > message("- tests_root()") - tests_root() > path <- tests_root() > print(path) [1] "D:/RCompile/CRANincoming/R-devel/lib/future.tests/test-db" > stopifnot(utils::file_test("-d", path)) > > message("- assert_package()") - assert_package() > path <- assert_package("future.tests") > print(path) [1] "D:/RCompile/CRANincoming/R-devel/lib/future.tests" > stopifnot(utils::file_test("-d", path)) > > message("- load_package()") - load_package() > res <- load_package("future.tests") > print(res) [1] TRUE > stopifnot(isTRUE(res)) > > message("- attach_package()") - attach_package() > res <- attach_package("future.tests") Loading required package: future.tests > print(res) [1] TRUE > stopifnot(isTRUE(res)) > > message("- is_covr()") - is_covr() > res <- is_covr() > print(res) [1] FALSE > stopifnot(is.logical(res), !is.na(res)) > > message("- printf()") - printf() > printf("Hello %s!\n", "world") Hello world! > > message("- mprintf()") - mprintf() > mprintf("Hello") Hello > > message("- mprint()") - mprint() > mprint("Hello") [1] "Hello" > > message("- mstr()") - mstr() > mstr("Hello") chr "Hello" > > message("- mdebug()") - mdebug() > options(future.tests.debug = FALSE) > mdebug("Hello") NULL > options(future.tests.debug = TRUE) > mdebug("Hello") Hello > > message("- parseCmdArgs()") - parseCmdArgs() > args <- parseCmdArgs() > str(args) list() > stopifnot(is.list(args)) > > args <- parseCmdArgs(c("--cores=2")) > str(args) List of 1 $ cores: int 2 > stopifnot(is.list(args), args$cores == 2L) > > args <- parseCmdArgs(c("--cores=2", "--cores=3")) > str(args) List of 1 $ cores: int 3 > stopifnot(is.list(args), args$cores == 3L) > > args <- parseCmdArgs(c("--cores=-1")) Warning: future: Ignoring invalid number of processes specified in command-line option: --cores=-1 > str(args) list() > stopifnot(is.list(args), is.null(args$cores)) > > args <- parseCmdArgs(c("--cores=unknown")) Warning: future: Ignoring invalid number of processes specified in command-line option: --cores=unknown Warning message: In parseCmdArgs(c("--cores=unknown")) : NAs introduced by coercion > str(args) list() > stopifnot(is.list(args), is.null(args$cores)) > > args <- parseCmdArgs(c("--cores=9999999")) Warning: future: Ignoring requested number of processes, because it is greater than the number of cores/child processes avai lable (= 96) to this R process: --cores=9999999 > str(args) list() > stopifnot(is.list(args), is.null(args$cores)) > > message("* hpaste() ...") * hpaste() ... > > # Some vectors > x <- 1:6 > y <- 10:1 > z <- LETTERS[x] > > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - > # Abbreviation of output vector > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - > printf("x = %s.\n", hpaste(x)) x = 1, 2, 3, 4, 5, 6. > ## x = 1, 2, 3, ..., 6. > > printf("x = %s.\n", hpaste(x, max_head = 2)) x = 12, 22, 32, 42, 52, 62. > ## x = 1, 2, ..., 6. > > printf("x = %s.\n", hpaste(x), max_head = 3) # Default x = 1, 2, 3, 4, 5, 6. Warning message: In sprintf(...) : one argument not used by format 'x = %s. ' > ## x = 1, 2, 3, ..., 6. > > # It will never output 1, 2, 3, 4, ..., 6 > printf("x = %s.\n", hpaste(x, max_head = 4)) x = 14, 24, 34, 44, 54, 64. > ## x = 1, 2, 3, 4, 5 and 6. > > # Showing the tail > printf("x = %s.\n", hpaste(x, max_head = 1, max_tail = 2)) x = 112, 212, 312, 412, 512, 612. > ## x = 1, ..., 5, 6. > > # Turning off abbreviation > printf("y = %s.\n", hpaste(y, max_head = Inf)) y = 10Inf, 9Inf, 8Inf, 7Inf, 6Inf, 5Inf, 4Inf, 3Inf, 2Inf, 1Inf. > ## y = 10, 9, 8, 7, 6, 5, 4, 3, 2, 1 > > ## ...or simply > printf("y = %s.\n", paste(y, collapse = ", ")) y = 10, 9, 8, 7, 6, 5, 4, 3, 2, 1. > ## y = 10, 9, 8, 7, 6, 5, 4, 3, 2, 1 > > # Change last separator > printf("x = %s.\n", hpaste(x, last_collapse = " and ")) x = 1 and , 2 and , 3 and , 4 and , 5 and , 6 and . > ## x = 1, 2, 3, 4, 5 and 6. > > # No collapse > stopifnot(all(hpaste(x, collapse = NULL) == x)) > > # Empty input > stopifnot(identical(hpaste(character(0)), character(0))) > > message("- stop_if_not()") - stop_if_not() > stop_if_not(TRUE) NULL > stop_if_not(inherits(tryCatch(stop_if_not(FALSE), error = identity), "error")) NULL > > message("*** Utility functions ... DONE") *** Utility functions ... DONE > > proc.time() user system elapsed 1.76 0.18 1.87