tests/testthat/test-font_info.R

test_that("failed font load does not corrupt the font cache", {
  expect_error(
    font_info(path = tempfile(fileext = ".ttf"), index = 0),
    "valid file"
  )
  # A valid load after the failure must still work
  expect_equal(nrow(font_info("sans")), 1)
})

Try the systemfonts package in your browser

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

systemfonts documentation built on Nov. 21, 2026, 9:06 a.m.