tests/testthat/test_b_verify_vc.R

test_that("verify_vc", {
  root <- tempfile(pattern = "git2rdata-verify-vc")
  dir.create(root)
  write_vc(
    x = test_data, file = "test.txt", root = root, sorting = "test_integer"
  )
  expect_s3_class(
    verify_vc("test.txt", root = root, variables = "test_integer"),
    "data.frame"
  )
  expect_s3_class(
    verify_vc(
      "test.txt", root = root, variables = c("test_numeric", "test_logical")
    ),
    "data.frame"
  )
  expect_error(
    verify_vc("test.txt", root = root, variables = c("test_integer", "junk")),
    "variables missing.*junk"
  )
})

Try the git2rdata package in your browser

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

git2rdata documentation built on Sept. 11, 2024, 5:51 p.m.