tests/testthat/test-error.R

testthat::context('Rendering errors')

path <- file.path(tempdir(),'tex_err')

cleanup(path)

tex_opts$set(returnType = 'tex',fileDir = path)
options(tinytex.compile.max_times = 1)

tex <- '\\begin{tabular}{ll}
3&3&3
\\end{tabular}'

testthat::describe('force an error',{
  
  it('error message', {
    testthat::expect_error(texPreview::tex_preview(tex,marker = FALSE),'LaTeX failed to compile')
  })

})

options(tinytex.compile.max_times = NULL)
cleanup(path,create = FALSE)

Try the texPreview package in your browser

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

texPreview documentation built on May 29, 2024, 5:45 a.m.