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 > library(fs) > > # test commented out to meet CRAN requirement > > # test_that("author name lookup with whoami minimally works", { > # local_edition(3) > # skip_on_cran() > # skip_if_offline() > # skip_if(Sys.info()["nodename"] != "ListiarMacBook2") > # > # libraryLocations=NULL > # > # print(.libPaths()) > # # fake the rstudio CRAN entry, the test runs without a value in options("repos"). > # > # n = "https://cran.rstudio.com/" > # names(n) = "CRAN" > # attr(n, "Rstudio") = TRUE > # > # origOptions = options(repos=n) > # > # if(require("whoami",quietly=TRUE)) > # { > # libraryLocations = path.package("whoami") > # libraryLocations = sub("(.*)/.*$","\\1",libraryLocations[1]) > # } > # > # if(!is.null(libraryLocations)) > # { > # if(length(libraryLocations) > 1) > # { > # stop("multiple installs of whoami, too complicated to resolve, giving up") > # } > # detach("package:whoami",unload=TRUE) > # remove.packages(c("whoami"), libraryLocations) > # } > # > # wkdir = paste0(tempdir(),"/testpdf/") > # workingDirectoryPopulate(wkdir) > # > # configVariablesLoad(paste0(wkdir,"/sample.config")) > # authorNowhoami = configVariableGet("config.author") > # > # install.packages("whoami") > # detach("package:WebAnalytics", unload=TRUE) > # library("WebAnalytics") > # library("whoami") > # > # configVariablesLoad(paste0(wkdir,"/sample.config")) > # authorWithwhoami = configVariableGet("config.author") > # > # expect_match(authorNowhoami, "Author") > # expect_match(authorWithwhoami, "Listiari Hunt") > # > # improbableAuthorName = "M V Llosa" > # configVariableSet("config.author", improbableAuthorName) > # expect_match(configVariableGet("config.author"), improbableAuthorName) > # > # > # unlink(wkdir,recursive=TRUE) > # > # if(is.null(libraryLocations)) > # { > # remove.packages("whoami",lib=libraryLocations) > # } else > # { > # install.packages("whoami",lib=libraryLocations) > # } > # options(origOptions) > # }) > > > test_that("config default values are correct", { + local_edition(3) + + wkdir = paste0(tempdir(),"/testpdf/") + workingDirectoryPopulate(wkdir) + + detach("package:WebAnalytics", unload=TRUE) + library("WebAnalytics") + + configVariablesLoad("variables.config") + + expect_equal(configVariableGet("config.generateGraphForTimeOver"), 10000) + expect_equal(configVariableGet("config.generateServerSessionStats"), TRUE) + expect_equal(configVariableGet("config.generatePercentileRankings"), FALSE) + expect_equal(configVariableGet("config.readBaseline"), FALSE) + expect_equal(configVariableGet("config.generateTransactionDetails"), TRUE) + expect_equal(configVariableGet("config.generateDiagnosticPlots"), TRUE) + expect_equal(configVariableGet("config.securityClass"), "Commercial-In-Confidence") + expect_equal(configVariableGet("config.readBaseline"), FALSE) + expect_equal(configVariableGet("config.useragent.generateFrequencies"), TRUE) + expect_equal(configVariableGet("config.useragent.minimumPercentage"), 2) + expect_equal(configVariableGet("config.useragent.maximumPercentile"), 96) + expect_equal(configVariableGet("config.useragent.discardOther"), TRUE) + + unlink(wkdir,recursive=TRUE) + }) [1] "file to be copied makerpt.ps1" [1] "file to be copied makerpt.sh" [1] "file to be copied logo.eps" [1] "file to be copied webanalytics.cls" [1] "file to be copied sampleRfile.R" [1] "file to be copied sample.config" Config Variables Set config.author CRAN config.current.columnList MSTimestamp ignored: s-ip httpop url ignored: cs-uri-query ignored: s-port ignored: cs-username userip useragent ignored: cs(Referer) httpcode ignored: sc-substatus ignored: sc-win32-status elapsedms config.current.dataDir . config.current.dirNames . config.documentName Subproject/Issue config.generateDiagnosticPlots TRUE config.generateGraphForTimeOver 10000 config.generatePercentileRankings FALSE config.generateServerSessionStats TRUE config.generateTransactionDetails TRUE config.longurls.threshold 1000 config.projectName Client/Project config.readBaseline FALSE config.securityClass Commercial-In-Confidence config.useragent.discardOther TRUE config.useragent.generateFrequencies TRUE config.useragent.maximumPercentile 96 config.useragent.minimumPercentage 2 Test passed 🎉 > > test_that("minimum config file works", { + local_edition(3) + + skip_on_cran() + + skip_on_os("windows") + skip_on_os("linux") + skip_on_os("solaris") + + wkdir = paste0(tempdir(),"/testpdf/") + workingDirectoryPopulate(wkdir) + fs::file_copy(paste0(getwd(), "/minimum.config"), paste0(wkdir,"/sample.config"),overwrite=TRUE) + + expect_snapshot(system(paste0("cd ", wkdir, "; ls; . ./makerpt.sh sample"))) + + system(paste0("open ",wkdir, "*.pdf ; sleep 1")) + unlink(wkdir,recursive=TRUE) + }) ── Skip: minimum config file works ───────────────────────────────────────────── Reason: On Windows > > proc.time() user system elapsed 1.76 0.43 3.70