R Under development (unstable) (2023-10-03 r85259 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. > library(testthat) > library(WebAnalytics) Loading required package: ggplot2 Loading required package: xtable Loading required package: data.table Loading required package: scales > > test_that("all names must match requires get last file name", { + expect_error(logFileNamesGet(allNamesMustMatch=TRUE, getLastFileName=FALSE), 'allNamesmustMatch=TRUE requires getLastFileName=TRUE') + }) Test passed 🎉 > test_that("data directory existence is checked", { + expect_error(logFileNamesGet(dataDirectory="missing"), 'Cannot find directory') + }) Test passed 🎉 > > test_that("data directory existence is checked", { + expect_error(logFileNamesGet(directoryNames=c("missing1","missing2")), 'Directory missing1 was not found under ') + }) Test passed 🥳 > > test_that("last log file is returned",{ + expect_equal(normalizePath(logFileNamesGetLast()), normalizePath(paste0(getwd(),"/u_getIISFields9.log"))) + }) Test passed 🎉 > > test_that("all log files are returned",{ + expect_equal(normalizePath(logFileNamesGetAll()), normalizePath(c(paste0(getwd(),"/u_getIISFields1.log"),paste0(getwd(),"/u_getIISFields2.log"), + paste0(getwd(),"/u_getIISFields3.log"),paste0(getwd(),"/u_getIISFields4.log"), + paste0(getwd(),"/u_getIISFields5.log"),paste0(getwd(),"/u_getIISFields6.log"), + paste0(getwd(),"/u_getIISFields7.log"),paste0(getwd(),"/u_getIISFields8.log"), + paste0(getwd(),"/u_getIISFields9.log")) + )) + }) Test passed 🎉 > > test_that("last matching files are returned",{ + expect_equal(normalizePath(logFileNamesGetLastMatching(directoryNames=c(".","."))), normalizePath(c(paste0(getwd(),"/u_getIISFields9.log"),paste0(getwd(),"/u_getIISFields9.log")))) + }) Test passed 😸 > > proc.time() user system elapsed 2.29 0.53 2.81