tests/testthat/test-ez_png.R

context("ez_png")

test_that("ez_png works", {
  ez_png(ggplot2::ggplot(),
         "test.png",
         check = FALSE)
  expect_true(file.exists("test.png"))
  unlink("test.png")

  suppressWarnings(
    expect_error(ez_png(ggplot2::ggplot(),
                      "temp_dir/test.png",
                      check = FALSE))
  )

  ez_png(ggplot2::ggplot(),
         "temp_dir/test.png",
         dir.create = TRUE,
         check = FALSE)
  expect_true(file.exists("temp_dir/test.png"))
  unlink("temp_dir", recursive = TRUE)

})

Try the ezplot package in your browser

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

ezplot documentation built on Nov. 26, 2023, 5:07 p.m.