tests/testthat/test-cpp.R

context("C++ API")

test_that("C++ API works", {

  skip_on_cran()

  Sys.setenv("R_TESTS" = "")

  dir.create(lib <- tempfile())
  on.exit(unlink(lib, recursive = TRUE), add = TRUE)
  install.packages("progresstest_1.0.0.tar.gz", lib = lib, quiet = FALSE)

  on.exit(unloadNamespace("progresstest"), add = TRUE)
  withr::with_libpaths(lib, action = "prefix", {
    withr::with_message_sink(
      file.path(lib, basename(tempfile())),
      expect_error(progresstest::my_test_progress(), NA)
    )
  })

  withr::with_libpaths(lib, action = "prefix", {
    withr::with_options(list(progress_enabled = FALSE),
      expect_false(progresstest::my_is_option_enabled())
    )
  })
})

Try the progress package in your browser

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

progress documentation built on May 17, 2019, 1:02 a.m.