tests/testthat/test-testthat.R

test_that("is_testthat", {
  expect_snapshot(is_testthat)

  testthat_path <- normalizePath("package/tests/testthat", winslash = "/")
  expect_equal(is_testthat$find_file(path = "package"), testthat_path)
  expect_equal(is_testthat$find_file(path = "package/tests"), testthat_path)
  expect_equal(is_testthat$find_file(path = "package/tests/testthat"), testthat_path)
})

test_that("dogfood", {
  expect_true(file.exists(is_testthat$find_file("hierarchy", "a", "b", "c", "d")))
})

Try the rprojroot package in your browser

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

rprojroot documentation built on Nov. 5, 2023, 5:06 p.m.