tests/testthat/test-regex-year-date.R

test_that("regex_year_date function works correctly", {
  # Test the function with the "yyyy" format
  regex <- regex_year_date("yyyy")
  expect_match("2023", regex)
  expect_no_match("2023-09-29", regex)

  # Test the function with the "yyyy-MM-dd" format
  regex <- regex_year_date("yyyy-MM-dd")
  expect_match("2023-09-29", regex)
  expect_no_match("2023/09/29", regex)

  # Add more tests here for other formats
})

Try the vvauditor package in your browser

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

vvauditor documentation built on May 29, 2024, 12:20 p.m.