Skip to content

Commit

Permalink
add test
Browse files Browse the repository at this point in the history
  • Loading branch information
teunbrand committed Sep 17, 2024
1 parent d37e8dc commit 6c60bac
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions tests/testthat/test-scales.R
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 6c60bac

Please sign in to comment.