Debian Codegraph @

tests/testthat/test-ffi.R

raw
1
2 test_that("all ffi methods have matching formal definitions", {
3
4 methods <- ls(envir = renv_envir_self(), pattern = "^__ffi__")
5 map(methods, function(method) {
6 lhs <- get(method, envir = renv_envir_self())
7 rhs <- get(substring(method, 8L), envir = renv_envir_self())
8 expect_identical(formals(lhs), formals(rhs))
9 })
10
11 })
12
13 test_that("the renv extensions library was loaded if available", {
14
15 skip_if_not(renv_ext_enabled())
16
17 # get path to shared library
18 nspath <- renv_namespace_path("renv")
19 soname <- if (renv_platform_windows()) "renv.dll" else "renv.so"
20 libsdir <- renv_package_libsdir(nspath)
21 sopath <- file.path(libsdir, soname)
22
23 # if it exists, it should be loaded
24 if (file.exists(sopath)) {
25
26 dllinfo <- find(library.dynam(), function(dllinfo) {
27 if (identical(dllinfo[["name"]], "renv"))
28 return(dllinfo)
29 })
30
31 expect_true(renv_path_same(sopath, dllinfo[["path"]]))
32
33 }
34
35 })