tests/test-cran/test-utils.R

library(testit)

assert('attr() is strict', {
  z = structure(list(a = 1), foo = 2)
  (attr(z, 'foo') %==% 2)
  (attr(z, 'f') %==% NULL)
})

assert('in_dir() preserves the working directory', {
  owd = getwd()
  in_dir('.', setwd(tempdir()))
  (same_path(owd, getwd()))
})

Try the xfun package in your browser

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

xfun documentation built on Nov. 2, 2023, 6 p.m.