A convenience wrapper to run code based on whether an environment variable is defined.
opttest(
expr,
testname = NULL,
testvar = "ENABLE_statnet_TESTS",
yesvals = c("y", "yes", "t", "true", "1"),
lowercase = TRUE
)An expression to be evaluated only if testvar is set to a
non-empty value.
Optional name of the test. If given, and the test is skipped, will print a message to that end, including the name of the test, and instructions on how to enable it.
Environment variable name. If set to one of the
yesvals, expr is run. Otherwise, an optional message is
printed.
A character vector of strings considered affirmative values
for testvar.
Whether to convert the value of testvar to lower
case before comparing it to yesvals.