tests/testthat/test-0-test-package-installation.R

context("Installation of Test Packages")
rm(list = ls())

# Test packages are installed in a temporary directory before testing and
# uninstalled after. Many pkgnet tests depend on these packages installing
# correctly and being available.

test_that('Test packages installed correctly',{
    testPkgNames <- c("baseballstats", "sartre", "milne", "silverstein")
    for (thisTestPkg in testPkgNames) {
        expect_true(
            object = require(thisTestPkg
                             , lib.loc = Sys.getenv('PKGNET_TEST_LIB')
                             , character.only = TRUE)
            , info = sprintf("Test package %s is not installed.", thisTestPkg)
        )
    }
})

Try the pkgnet package in your browser

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

pkgnet documentation built on Dec. 23, 2021, 9:07 a.m.