R Under development (unstable) (2023-12-04 r85659 ucrt) -- "Unsuffered Consequences" Copyright (C) 2023 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. > #!/usr/bin/Rscript --vanilla > is_failure <- function(result) { + res <- RUnit::getErrors(result) + names(res) <- tolower(names(res)) # soothe lintr + sum_of_exceptions <- res[["nerr"]] + res[["nfail"]] + fail <- as.logical(sum_of_exceptions) + return(fail) + } > > if (interactive()) { + pkgload::load_all(path = ".") # needed to use pkgload's shim version of + # base's system.file + unit_dir <- system.file("inst", "runit_tests", package = "rBDAT") + } else { + require("rBDAT", quietly = TRUE, character.only = TRUE) || + pkgload::load_all(path = ".") # needed to use pkgload's shim version of + r_call <- commandArgs(trailingOnly = FALSE) + if (any(grepl("--file", r_call))) { + unit_dir <- file.path("inst", "runit_tests") + } else { + unit_dir <- system.file("runit_tests", package = "rBDAT") + } + } This is rBDAT 1.0.0 > if (!dir.exists(unit_dir)) { + stop( + "Can not find RUnit test directory ", unit_dir, + ". Try to (re)install the package first." + ) + } > setup_file <- file.path(unit_dir, "setup.R") > if (file.exists(setup_file)) source(setup_file) > package_suite <- RUnit::defineTestSuite("rBDAT_unit_test", + dirs = unit_dir, + testFileRegexp = "^runit.*\\.[rR]", + testFuncRegexp = "^test_+" + ) > test_result <- RUnit::runTestSuite(package_suite) Executing test function test_exception ... Error in eval(expr, envir = parent.frame()) : Hello, error! In addition: Warning messages: 1: In RNGkind(kind = testSuite$rngKind, normal.kind = testSuite$rngNormalKind) : RNGkind: Marsaglia-Multicarry has poor statistical properties 2: In RNGkind(kind = testSuite$rngKind, normal.kind = testSuite$rngNormalKind) : RNGkind: severe deviations from normality for Kinderman-Ramage + Marsaglia-Multicarry done successfully. > RUnit::printTextProtocol(test_result, showDetails = TRUE, fileName = "") RUNIT TEST PROTOCOL -- Wed Dec 6 15:13:15 2023 *********************************************** Number of test functions: 1 Number of errors: 0 Number of failures: 0 1 Test Suite : rBDAT_unit_test - 1 test function, 0 errors, 0 failures Details *************************** Test Suite: rBDAT_unit_test Test function regexp: ^test_+ Test file regexp: ^runit.*\.[rR] Involved directory: D:/RCompile/CRANincoming/R-devel/lib/rBDAT/runit_tests --------------------------- Test file: D:/RCompile/CRANincoming/R-devel/lib/rBDAT/runit_tests/runit-throw.R test_exception: (1 checks) ... OK (0 seconds) > if (is_failure(test_result)) { + RUnit::printTextProtocol(test_result, showDetails = TRUE) + stop("RUnit failed.") + } > > proc.time() user system elapsed 0.23 0.09 0.28