Skip to content

Commit 1c205e0

Browse files
committed
Test for warning
1 parent b71e90d commit 1c205e0

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

tests/testthat/test-scales.r

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,3 +167,13 @@ test_that("find_global searches in the right places", {
167167
expect_identical(find_global("scale_colour_hue", emptyenv()),
168168
ggplot2::scale_colour_hue)
169169
})
170+
171+
test_that("Scales warn when transforms introduces non-finite values", {
172+
df <- data.frame(x = c(1e1, 1e5), y = c(0, 100))
173+
174+
p <- ggplot(df, aes(x, y)) +
175+
geom_point(size = 5) +
176+
scale_y_log10()
177+
178+
expect_warning(ggplot_build(p), "Transformation introduced infinite values")
179+
})

0 commit comments

Comments
 (0)