Skip to content

Commit 2a8cd27

Browse files
committed
catch tests where this occurs
1 parent 78be71d commit 2a8cd27

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

tests/testthat/test-aes-calculated.R

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,11 @@ test_that("make_labels() deparses mappings properly", {
4747
expect_match(x_lab, "...$")
4848
# if the mapping is a literal or NULL, the aesthetics is used
4949
expect_identical(make_labels(aes(x = 1)), list(x = "x"))
50-
expect_identical(make_labels(aes(x = NULL)), list(x = "x"))
50+
# NULL labels should only be used as fallback labels
51+
expect_identical(
52+
make_labels(aes(x = NULL)),
53+
list(x = structure("x", fallback = TRUE))
54+
)
5155
})
5256

5357
test_that("staged aesthetics warn appropriately for duplicated names", {

tests/testthat/test-aes.R

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,8 @@ test_that("quosures are squashed when creating default label for a mapping", {
103103
test_that("labelling doesn't cause error if aesthetic is NULL", {
104104
p <- ggplot(mtcars) + aes(x = NULL)
105105
labels <- ggplot_build(p)@plot@labels
106-
expect_identical(labels$x, "x")
106+
# NULL labels should only be used as fallback labels
107+
expect_identical(labels$x, structure("x", fallback = TRUE))
107108
})
108109

109110
test_that("aes standardises aesthetic names", {

0 commit comments

Comments
 (0)