tests/testthat/test_options.R

library(loon)
context("test_options")

test_that("changing options works", {
    userSettable <- l_userOptions()
    otherOptions <- setdiff(l_getOptionNames(), userSettable)
    for(optName in userSettable) {
        opt <- l_getOption(optName)
        l_setOption(optName, "fubar")
        expect_equal(l_getOption(optName), "fubar")
        l_setOption(optName, opt)
        expect_equal(l_getOption(optName), opt)
    }
    for(optName in otherOptions) {
        opt <- l_getOption(optName)
        expect_error(l_setOption(optName, "fubar"))
        expect_equal(l_getOption(optName), opt)
    }
}
)

Try the loon package in your browser

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

loon documentation built on June 14, 2021, 9:07 a.m.