diff --git a/tests/testthat/test-scales.R b/tests/testthat/test-scales.R index 0ba2989e39..f8881a16a7 100644 --- a/tests/testthat/test-scales.R +++ b/tests/testthat/test-scales.R @@ -731,6 +731,17 @@ test_that("Discrete scales with only NAs return `na.value`", { expect_equal(sc$map(x), c(NA_real_, NA_real_)) }) +test_that("continuous scales warn about faulty `limits`", { + expect_error( + scale_x_continuous(limits = c("A", "B")), + "not a character vector" + ) + expect_error( + scale_x_continuous(limits = 1:3), + "length 2, not length 3" + ) +}) + test_that("discrete scales work with NAs in arbitrary positions", { # Prevents intermediate caching of palettes map <- function(x, limits) {