tests/testthat/test-special-rmd-formats.R

# WARNING - Generated by {fusen} from dev/flat_split_combine.Rmd: do not edit by hand

# Test other formats
file <- system.file("dev-yaml-only.Rmd",
  package = "lightparser"
)
# debugonce(split_to_tbl)
test_that("yaml only file works", {
  expect_error(tbl_rmd <- split_to_tbl(file), regexp = NA)
  expect_true(nrow(tbl_rmd) == 1)
  expect_equal(tbl_rmd[["type"]], "yaml")
  expect_equal(length(tbl_rmd[["params"]][[1]]), 3)
})

# Test other formats
file <- system.file("example-no-headers.qmd",
  package = "lightparser"
)

test_that("file with no headers is good", {
  expect_error(tbl_rmd <- split_to_tbl(file), regexp = NA)
  expect_true(nrow(tbl_rmd) == 7)
  expect_true(all(is.na(tbl_rmd[["heading"]])))
})

Try the lightparser package in your browser

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

lightparser documentation built on May 29, 2024, 4:39 a.m.