Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
HYCAR-Hydro
airGR
Commits
b05d5530
Commit
b05d5530
authored
Oct 15, 2020
by
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
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
tests/testthat/store_examples.R
View file @
b05d5530
...
...
@@ -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
)
{
...
...
tests/testthat/test-regression.R
View file @
b05d5530
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
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment