Skip to content

Commit c518dee

Browse files
committed
add tests
1 parent fd5a831 commit c518dee

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

tests/testthat/test-scale-date.R

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ test_that("datetime colour scales work", {
6969
expect_equal(range(get_layer_data(p)$colour), c("#132B43", "#56B1F7"))
7070
})
7171

72-
test_that("date(time) scales throw warnings when input is numeric", {
72+
test_that("date(time) scales throw warnings when input is incorrect", {
7373
p <- ggplot(data.frame(x = 1, y = 1), aes(x, y)) + geom_point()
7474

7575
expect_warning(
@@ -82,4 +82,19 @@ test_that("date(time) scales throw warnings when input is numeric", {
8282
"The value was converted to a <POSIXt/POSIXct> object."
8383
)
8484

85+
expect_error(
86+
ggplot_build(p + scale_x_date(date_breaks = c(11, 12))),
87+
"must be a single string"
88+
)
89+
90+
expect_error(
91+
ggplot_build(p + scale_x_date(date_minor_breaks = c(11, 12))),
92+
"must be a single string"
93+
)
94+
95+
expect_error(
96+
ggplot_build(p + scale_x_date(date_labels = c(11, 12))),
97+
"must be a single string"
98+
)
99+
85100
})

0 commit comments

Comments
 (0)