File: test-test-compiled-code.R

package info (click to toggle)
r-cran-testthat 3.3.2-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 4,048 kB
  • sloc: cpp: 9,269; sh: 14; ansic: 14; makefile: 5
file content (26 lines) | stat: -rw-r--r-- 691 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
test_that("get_routine() finds own 'run_testthat_tests'", {
  routine <- get_routine("testthat", "run_testthat_tests")
  expect_s3_class(routine, "NativeSymbolInfo")
})

test_that("get_routine() fails when no routine exists", {
  expect_snapshot(error = TRUE, get_routine("utils", "no_such_routine"))
})

test_that("validates inputs", {
  expect_snapshot(error = TRUE, {
    expect_cpp_tests_pass(123)
    run_cpp_tests(123)
  })
})

test_that("useful messaging", {
  path <- withr::local_tempdir()
  writeLines("Package: foo", file.path(path, "DESCRIPTION"))
  dir.create(file.path(path, "R"))

  expect_snapshot(use_catch(path))
})

skip_if_not_installed("xml2")
run_cpp_tests("testthat")