diff --git a/tests/testthat/store_examples.R b/tests/testthat/store_examples.R index 6a7b8e31a1d6174045718c86a86764692765de6b..24160040b04747114a25f5fc6006c727c5df1839 100644 --- a/tests/testthat/store_examples.R +++ b/tests/testthat/store_examples.R @@ -45,7 +45,7 @@ StoreTopicResults <- function(topic, package, path, run.dontrun = TRUE, run.dont cat("*", topic, "\n") cat("*******************************\n") - par(ask=F) #https://stackoverflow.com/questions/34756905/how-to-turn-off-the-hit-return-to-see-next-plot-prompt-plot3d + par(ask = FALSE) #https://stackoverflow.com/questions/34756905/how-to-turn-off-the-hit-return-to-see-next-plot-prompt-plot3d varBefore <- c() varBefore <- ls(envir = globalenv()) @@ -60,7 +60,7 @@ StoreTopicResults <- function(topic, package, path, run.dontrun = TRUE, run.dont varToSave <- setdiff(varAfter, varBefore) - if(length(varToSave) > 0) { + if (length(varToSave) > 0) { path <- file.path(path, topic) dir.create(path, showWarnings = FALSE, recursive = TRUE) lapply(varToSave, function(x) { diff --git a/tests/testthat/test-regression.R b/tests/testthat/test-regression.R index 866fcdfece05d0355ead2a23added080592d4730..432c561d644017d382aaacbd66b3753a54a33ec8 100644 --- a/tests/testthat/test-regression.R +++ b/tests/testthat/test-regression.R @@ -1,11 +1,9 @@ context("Compare example outputs with CRAN") CompareWithRef <- function(refVarFile, testDir, regIgnore) { - v <- data.frame( - topic = basename(dirname(refVarFile)), - var = gsub("\\.rds$", "", basename(refVarFile)) - ) - if(is.null(regIgnore) || all(apply(regIgnore, 1, function(x) {!all(x == v)}))) { + v <- data.frame(topic = basename(dirname(refVarFile)), + var = gsub("\\.rds$", "", basename(refVarFile))) + if (is.null(regIgnore) || all(apply(regIgnore, 1, function(x) !all(x == v)))) { test_that(paste("Compare", v$topic, v$var), { skip_on_cran() testVarFile <- paste0( @@ -13,7 +11,7 @@ CompareWithRef <- function(refVarFile, testDir, regIgnore) { ".rds" ) expect_true(file.exists(testVarFile)) - if(file.exists(testVarFile)) { + if (file.exists(testVarFile)) { testVar <- readRDS(testVarFile) refVar <- readRDS(refVarFile) expect_equivalent(testVar, refVar) @@ -22,15 +20,14 @@ CompareWithRef <- function(refVarFile, testDir, regIgnore) { } } -if(dir.exists("../tmp/ref") & dir.exists("../tmp/test")) { +if (dir.exists("../tmp/ref") & dir.exists("../tmp/test")) { refVarFiles <- list.files("../tmp/ref", recursive = TRUE, full.names = TRUE) regIgnoreFile <- "../../.regressionignore2" - if(file.exists(regIgnoreFile)) { - regIgnore <- read.table( - file = regIgnoreFile, - sep = " ", header = FALSE, skip = 5, col.names = c("topic", "var"), - stringsAsFactors = FALSE - ) + if (file.exists(regIgnoreFile)) { + regIgnore <- read.table(file = regIgnoreFile, + sep = " ", header = FALSE, skip = 5, + col.names = c("topic", "var"), + stringsAsFactors = FALSE) } else { regIgnore <- NULL }