tests/testthat/test-logging.R

context("Test logger functions.")
rm(list = ls())

##### TESTS #####

test_that("logging works", {

    expect_true({
        log_info("the stuff")
        TRUE
    })

    expect_warning({
        log_warn("some stuff")
    }, regexp = "some stuff")

    expect_error({
        log_fatal("other stuff")
    }, regexp = "other stuff")

})

##### TEST TEAR DOWN #####

rm(list = ls())
closeAllConnections()

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.