R Under development (unstable) (2023-12-09 r85665 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. > stopifnot(require(RUnit, quietly=TRUE)) > stopifnot(require(yaml, quietly=TRUE)) > > # Set RUnit options > if (!getOption("yaml.verbose", FALSE)) { + opts <- getOption("RUnit") + opts$silent <- TRUE + opts$verbose <- FALSE + options("RUnit" = opts) + } > > # Test helpers > captureWarnings <- function(expr) { + warnings <- character(0) + suppressWarnings({ + withCallingHandlers(expr, warning = function(w) { + warnings <<- c(warnings, w$message) + }) + }) + warnings + } > > checkWarning <- function(expr) { + warnings <- captureWarnings(expr) + checkTrue(length(warnings) > 0) + } > > checkNamedListEquals <- function(x, y) { + checkEquals(class(x), class(y)) + checkEquals(length(x), length(y)) + + ns <- sort(names(x)) + checkEquals(ns, sort(names(y))) + for (n in ns) { + checkEquals(x[[n]], y[[n]]) + } + } > > # Define tests > testSuite <- defineTestSuite(name = "yaml tests", + dirs = system.file("tests", package = "yaml"), + testFileRegexp = "^test_.+", + testFuncRegexp = "^test_.+", + rngKind = 'Mersenne-Twister', + rngNormalKind = 'Inversion') > > tests <- runTestSuite(testSuite) > > # Print results > printTextProtocol(tests, showDetails = FALSE) RUNIT TEST PROTOCOL -- Mon Dec 11 18:12:00 2023 *********************************************** Number of test functions: 171 Number of errors: 0 Number of failures: 0 1 Test Suite : yaml tests - 171 test functions, 0 errors, 0 failures > > # Return success or failure to R CMD CHECK > if (getErrors(tests)$nFail > 0) { + stop("TEST FAILED!") + } > if (getErrors(tests)$nErr > 0) { + stop("TEST HAD ERRORS!") + } > if (getErrors(tests)$nTestFunc < 1) { + stop("NO TEST FUNCTIONS RUN!") + } > > proc.time() user system elapsed 0.21 0.06 0.26