tests/testthat/helper-testFunctions.R

# helpers for data

getdata <- function(dir, name) {
	readRDS(paste("testdata/", dir, "/", name, ".rds", sep = ""))
}

sourcedata <- function(dir, name) {
	source(paste("testdata/", dir, "/", name, ".R", sep = ""))
}

# hacky trick for testing with no messages in the terminal

quietly <- function(e) suppressMessages(capture.output(e))

quietly_test_that <- function(desc, code) {
	test_that(desc, {quietly(code)})
}

# skippers

skip_if_r_version_leq <- function(version) {
	skip_if(is_curr_r_version_leq(version))
}

is_curr_r_version_leq <- function(version) {
	package_version(R.version) <= package_version(version)
}

Try the APackOfTheClones package in your browser

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

APackOfTheClones documentation built on Oct. 11, 2024, 1:08 a.m.