File: test-vendor.R

package info (click to toggle)
r-cran-cpp11 0.5.2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,428 kB
  • sloc: cpp: 9,732; sh: 14; makefile: 2
file content (31 lines) | stat: -rw-r--r-- 778 bytes parent folder | download | duplicates (3)
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
27
28
29
30
31
describe("cpp_vendor", {
  it("errors if cpp11 is not installed", {
    pkg <- local_package()
    mockery::stub(cpp_vendor, "system.file", "")
    expect_error(
      cpp_vendor(pkg_path(pkg)),
      "cpp11 is not installed"
    )
  })

  it("errors if cpp11 is already vendored", {
    pkg <- local_package()
    cpp_vendor(pkg_path(pkg))

    expect_error(
      cpp_vendor(pkg_path(pkg)),
      "already exists"
    )
  })

  it("vendors cpp11", {
    pkg <- local_package()
    p <- pkg_path(pkg)

    cpp_vendor(pkg_path(pkg))

    expect_true(dir.exists(file.path(p, "inst", "include", "cpp11")))
    expect_true(file.exists(file.path(p, "inst", "include", "cpp11.hpp")))
    expect_true(file.exists(file.path(p, "inst", "include", "cpp11", "declarations.hpp")))
  })
})