Skip to content

Commit

Permalink
add test
Browse files Browse the repository at this point in the history
  • Loading branch information
teunbrand committed Oct 7, 2024
1 parent bef35bf commit e01e439
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions tests/testthat/test-label-date.R
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,15 @@ test_that("can set locale", {
expect_equal(time_format("%B", locale = "fr")(x), "janvier")
})

test_that("label_date_short can replace leading zeroes", {
x <- seq(as.Date("2024-01-01"), as.Date("2025-01-01"), by = "1 month")
labels <- label_date_short(
format = c("%Y", "%m", "%d"),
sep = "-", leading = "x"
)(x)
expect_equal(labels, c("x1-2024", paste0("x", 2:9), c(10:12), "x1-2025"))
})

test_that("date_short doesn't change unexpectedly", {
expect_snapshot({
dformat <- label_date_short()
Expand Down

0 comments on commit e01e439

Please sign in to comment.