R version 4.4.0 alpha (2024-04-08 r86370 ucrt) Copyright (C) 2024 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 file is part of the 'stringx' project. > # Copyleft (c) 2021-2024, Marek Gagolewski > > # Runs all unit tests for the package > > this_package <- "stringx" > > set.seed(123) > library(this_package, character.only=TRUE) Attaching package: 'stringx' The following objects are masked from 'package:base': casefold, chartr, endsWith, gregexec, gregexpr, grep, grepl, gsub, ISOdate, ISOdatetime, nchar, nzchar, paste, paste0, regexec, regexpr, sprintf, startsWith, strftime, strptime, strrep, strsplit, strtrim, strwrap, sub, substr, substr<-, substring, substring<-, Sys.time, tolower, toupper, trimws, xtfrm, xtfrm.default > if (require("realtest", quietly=TRUE)) { + f <- file.path(path.package(this_package), "realtest") + r <- test_dir(f, ".*\\.R$") + x <- summary(r) + + names(r) <- row.names(x) + fails <- x[x[["match"]] == "fail", , drop=FALSE] + if (nrow(fails) > 0) { + fails2 <- as.data.frame(fails[, + !(names(fails) %in% ".expr") & !sapply(fails, function(x) all(is.na(x))), + drop=FALSE]) + for (i in row.names(fails2)) { + cat(sprintf("%s:%d:\n", fails2[i, ".file"], fails2[i, ".line"])) + cat(" value: "); str(r[[i]][["object"]][["value"]], indent.str=" ") + cat(" sides: "); str(r[[i]][["object"]][["sides"]], indent.str=" ") + } + + if (require("stringi", quietly=TRUE)) + cat(sprintf("%s; %s\n", stri_info(TRUE), Sys.getlocale())) + + stop("some tests failed") + } + } > > proc.time() user system elapsed 1.25 0.06 1.28