tests/testthat/test_e_generate_svg.R

test_that("generate_svg()", {
  test_file <- tempfile("generate", fileext = ".svg")
  on.exit(file.remove(test_file), add = TRUE)
  qrc <- qr_code("generate_svg()")
  expect_invisible(generate_svg(qrc, filename = test_file, show = FALSE))
  file_test("-f", test_file)

  test_file2 <- tempfile("generate", fileext = ".svg")
  on.exit(file.remove(test_file2), add = TRUE)
  qrc <- qr_wifi(ssid = "mynetwork", key = "topsecret")
  expect_invisible(generate_svg(qrc, filename = test_file2, show = FALSE))
  file_test("-f", test_file2)
})

Try the qrcode package in your browser

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

qrcode documentation built on Nov. 11, 2023, 5:07 p.m.