tests/testthat/test-log.r

test_that("user_cache_dir works as expected", {
  expect_equal(user_log_dir("R", os = "mac"), "~/Library/Logs/R")

  withr::local_envvar(XDG_CACHE_HOME = "/cache")
  expect_equal(user_log_dir("R", os = "unix"), "/cache/R/log")
  expect_equal(user_log_dir("R", os = "unix", opinion = FALSE), "/cache/R")
})

test_that("user_cache_dir works with windows simulation", {
  skip_on_os("windows")
  expect_equal(
    user_log_dir("R", os = "win"),
    "<USERPROFILE>/Local Settings/Application Data/R/R/Logs"
  )
})

Try the rappdirs package in your browser

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

rappdirs documentation built on Jan. 31, 2021, 9:06 a.m.