tests/testthat/test-format_ay.R

test_that("Rejects non 6-digit numbers", {
  expect_error(format_ay(19858))
  expect_error(format_ay(1985))
  expect_error(format_ay(1985867))
  expect_error(format_ay("1999c"))
  expect_error(format_ay("abcdef"))
  expect_error(format_ay("1985-98"))
})

test_that("Converts correctly", {
  expect_equal(format_ay(199920), "1999/20")
  expect_equal(format_ay("199920"), "1999/20")
})

Try the dfeR package in your browser

Any scripts or data that you put into this service are public.

dfeR documentation built on April 12, 2025, 1:32 a.m.