Skip to content

Commit 50b6cf4

Browse files
authored
Merge pull request #64 from ropensci/no-ld
make tests robust to less precision
2 parents 990b003 + 0de81a3 commit 50b6cf4

File tree

2 files changed

+11
-7
lines changed

2 files changed

+11
-7
lines changed

cran-comments.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
## Release Overview
22

3-
Minor update to make tests compatible with the development version of the 'scales' package, which changes slightly the color outputs from some functions used by this package. Also incoporates a few bug fixes and minor features that address issues brought up by users of the package.
3+
# Minor update to make tests compatible with the development version of the 'scales' package, which changes slightly the color outputs from some functions used by this package. Also incoporates a few bug fixes and minor features that address issues brought up by users of the package.
4+
5+
Also addresses the issue with noLD, making the tests robust to less precision. Tested using the "debian-gcc-devel-nold" platform on rhub.
46

57
Tested on Windows, Mac, and Linux via Travis, Appveyor, and/or Rhub.
68

tests/testthat/helper_expectation.R

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
1-
remove_colors <- function(x) {
1+
remove_text <- function(x) {
22
# Colors are problematic because a slight change in color will lead to test
33
# failing -- this helper function removes them.
44
x$colorscale <- x$colorscale[[1]]
5+
# Text is problematic because it is sensitive to precision because has numbers in it
6+
x$text <- length(x$text)
57

68
x
79
}
810

9-
replace_colorscales <- function(x) {
10-
x$data <- lapply(x$data, remove_colors)
11+
replace_text <- function(x) {
12+
x$data <- lapply(x$data, remove_text)
1113
x
1214
}
1315

@@ -24,10 +26,10 @@ expect_ihm_equal_to_reference <- function(object, file, ..., info = NULL) {
2426
} else {
2527
reference <- readRDS(file)
2628

27-
objectsub <- replace_colorscales(object$x[c("data","layout")])
28-
referencesub <- replace_colorscales(reference$x[c("data","layout")])
29+
objectsub <- replace_text(object$x[c("data","layout")])
30+
referencesub <- replace_text(reference$x[c("data","layout")])
2931

30-
comp <- testthat::compare(objectsub, referencesub, ...)
32+
comp <- testthat::compare(objectsub, referencesub, tolerance = 0.1, ...)
3133
expect(
3234
comp$equal,
3335
sprintf("Not equal to %s.\n%s", lab_exp, comp$message),

0 commit comments

Comments
 (0)