README.md

Project Status: WIP – Initial development is in progress, but there has not yet been a stable, usable release suitable for the public. CRAN status R build status Codecov test coverage pkgdown

R Package hySpc.testthat

This package is a member of the r-hyperspec packages family and it provides some addons for testthat used by hyperSpec and hySpc.*.

Documentation

Online documentation is available via pkgdown. In short:

hySpc.testthat allows attaching unit tests to functions to keep test and function code close to each other:

library(testthat)

f <- function(x) 2*x

hySpc.testthat::test(f) <- function() {
  context("testing f")

  test_that("foo", expect (bar))
}

f
## function(x) 2*x
## attr(,"test")
## function() {
##   context("testing f")
##   
##   test_that("foo", expect (bar))
## }

Functions test_fun() and unittest() execute unit tests that are attached to functions.

See tests/testthat/test_attached.R for including these tests into the usual test suit executed by devtools::test().

Issues, Bug Reports and Feature Requests

Issues, bug reports and feature requests should go to an appopriate package's repository:

Installation

Install from CRAN

You can install the released version of hySpc.testthat from CRAN with:

install.packages("hySpc.testthat")

Install from CRAN-like Repository

The recommended way to install the in-development version:

repos <- c("https://r-hyperspec.github.io/pkg-repo/", getOption("repos"))
install.packages("hySpc.testthat", repos = repos)


r-hyperspec/hySpc.testthat documentation built on May 1, 2023, 12:23 a.m.