Commit b05d5530 authored by Delaigue Olivier's avatar Delaigue Olivier
Browse files

test(style): minor typo revisions in regression tests

parent 4df67cf0
Pipeline #16673 passed with stages
in 10 minutes and 40 seconds
......@@ -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) {
......
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
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment