tests/testthat/test-odin-options.R

context("odin_options")

test_that("odin_options creates a classed list", {
  opts <- odin_options()
  expect_s3_class(opts, "odin_options")
  expect_true(is.list(opts))
})

test_that("can create placeholder handler for include parsing", {
  opts <- odin_options(target = "fortran")
  expect_error(
    opts$read_include(),
    "'config(include)' is not supported for target 'fortran'", fixed = TRUE)
})


test_that("manually set parsing functions persist", {
  opts <- odin_options(target = "fortran")
  opts$read_include <- read_include_c
  expect_identical(odin_options(options = opts)$read_include, read_include_c)
})

Try the odin package in your browser

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

odin documentation built on Oct. 2, 2023, 5:07 p.m.