tests/testthat/test_test_model.R

test_that("test_model runs code in test file", {
  test_file1 <- tempfile()
  test_file2 <- tempfile()
  model <- tempfile()
  on.exit(add = TRUE, {
    unlink(test_file1)
    unlink(test_file2)
    unlink(model)
  })
  writeLines("testthat::expect_true(TRUE)", test_file1)
  writeLines("testthat::expect_true(FALSE)", test_file2)
  writeLines("{\"build\": true}", model)
  expect_error(test_model(model, test_file1, package = "foo"), NA)
  expect_error(test_model(model, test_file2, package = "foo"))
})

Try the PKPDsim package in your browser

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

PKPDsim documentation built on March 7, 2023, 5:40 p.m.