tests/testthat/test-captions.R

test_that("captions functions work", {
  latex <- kableExtra::kbl(mtcars[1:2, 1:2], format = "latex", caption = "the caption")
  parsed <- parseLatex(latex)
  path <- path_to(parsed, is_env, envtypes = "table", all = FALSE)
  table <- parsed[[path]]

  expect_snapshot(find_caption(table))
  expect_snapshot(path_to_caption(parsed))

  table <- prepare_table(table)

  expect_snapshot(find_caption(table))
  parsed[[path]] <- table
  expect_snapshot(path_to_caption(parsed))
})

Try the parseLatex package in your browser

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

parseLatex documentation built on June 8, 2025, 10:19 a.m.