Skip to content

Commit d534309

Browse files
committed
skip gnarly snapshots
1 parent e55b96f commit d534309

File tree

5 files changed

+15
-9
lines changed

5 files changed

+15
-9
lines changed

tests/testthat/_snaps/aes.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# aes evaluated in environment where plot created
1+
# accessing an undefined variable results in an error
22

33
Code
44
get_layer_data(p)

tests/testthat/_snaps/empty-data.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
Error in `combine_vars()`:
1515
! Faceting variables must have at least one value.
1616

17-
# empty data overrides plot defaults
17+
# Should error when totally empty data frame because there's no x and y
1818

1919
Code
2020
get_layer_data(d)

tests/testthat/test-aes.R

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,10 @@ test_that("aes evaluated in environment where plot created", {
4848
df <- data_frame(x = 1, y = 1)
4949
p <- ggplot(df, aes(foo, y)) + geom_point()
5050

51-
# Accessing an undefined variable should result in error
52-
expect_snapshot(get_layer_data(p), error = TRUE)
51+
test_that("accessing an undefined variable results in an error", {
52+
skip_if(getRversion() <= "4.4.0")
53+
expect_snapshot(get_layer_data(p), error = TRUE)
54+
})
5355

5456
# Once it's defined we should get it back
5557
foo <- 0

tests/testthat/test-empty-data.R

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,13 @@ test_that("layers with empty data are silently omitted with facet_grid", {
5353
})
5454

5555
test_that("empty data overrides plot defaults", {
56-
# Should error when totally empty data frame because there's no x and y
57-
d <- ggplot(mtcars, aes(mpg, wt)) +
58-
geom_point() +
59-
geom_point(data = data_frame())
60-
expect_snapshot(get_layer_data(d), error = TRUE)
56+
test_that("Should error when totally empty data frame because there's no x and y", {
57+
skip_if(getRversion() <= "4.4.0")
58+
d <- ggplot(mtcars, aes(mpg, wt)) +
59+
geom_point() +
60+
geom_point(data = data_frame())
61+
expect_snapshot(get_layer_data(d), error = TRUE)
62+
})
6163

6264
# No extra points when x and y vars don't exist but are set
6365
d <- ggplot(mtcars, aes(mpg, wt)) +

tests/testthat/test-fortify.R

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,8 @@ test_that("fortify.default can handle healthy data-frame-like objects", {
100100

101101
# Rejected by fortify.default() because of unhealthy dim() behavior
102102

103+
skip_if(getRversion() <= "4.4.0")
104+
103105
dim.foo <- function(x) stop("oops!")
104106
registerS3method("dim", "foo", dim.foo)
105107
expect_snapshot(fortify(object), error = TRUE)

0 commit comments

Comments
 (0)