tests/testthat/test-liblog.R

test_that("liblog works", {
  # tmp <- tempfile()
  # options(liblog.path = tmp)
  expect_message(use_liblog(TRUE), "Tracing function")
  expect_message(use_liblog(FALSE), NA)
  expect_error(.onLoad(), NA)
  tmp <- tempfile()
  options(liblog.path = tmp)
  library(tools)
  expect_true(file.exists(tmp))
  expect_error(
    content <- scan(file = tmp, what = character(), sep = ",", strip.white = TRUE),
    NA)
  expect_length(content, 2)
  expect_identical(content[[2]], "tools")
})


test_that("get_liblog works", {
  expect_error(get_liblog(), NA)
  expect_error(get_liblog(duplicates = TRUE, default = TRUE, base = TRUE, recommended = TRUE), NA)
})
moodymudskipper/liblog documentation built on Feb. 26, 2020, 12:52 a.m.