Skip to content

Commit 553e5c7

Browse files
committed
Merge pull request #16 from pachadotdev/255
255
1 parent 6833cba commit 553e5c7

File tree

1 file changed

+18
-26
lines changed

1 file changed

+18
-26
lines changed

tests/testthat/test-vendor.R

Lines changed: 18 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,23 @@
1-
test_that("cpp_vendor errors if cpp11 is not installed", {
2-
pkg <- local_package()
1+
describe("cpp_vendor", {
2+
it("errors if cpp11 is not installed", {
3+
pkg <- local_package()
4+
mockery::stub(cpp_vendor, "system.file", "")
5+
expect_error(
6+
cpp_vendor(pkg_path(pkg)),
7+
"cpp11 is not installed"
8+
)
9+
})
310

4-
expect_error(
5-
cpp_vendor(pkg_path(pkg), headers = ""),
6-
"cpp11 is not installed"
7-
)
8-
})
9-
10-
test_that("cpp_vendor errors if cpp11 is already vendored", {
11-
pkg <- local_package()
12-
cpp_vendor(pkg_path(pkg))
13-
14-
expect_error(
15-
cpp_vendor(pkg_path(pkg)),
16-
"already exists"
17-
)
18-
})
19-
20-
test_that("cpp_vendor vendors cpp11", {
21-
pkg <- local_package()
22-
p <- pkg_path(pkg)
11+
it("vendors cpp11", {
12+
pkg <- local_package()
13+
p <- pkg_path(pkg)
2314

24-
cpp_vendor(pkg_path(pkg))
15+
cpp_vendor(pkg_path(pkg))
2516

26-
expect_true(dir.exists(file.path(p, "inst", "include", "cpp11")))
27-
expect_true(file.exists(file.path(p, "inst", "include", "cpp11.hpp")))
28-
expect_true(file.exists(file.path(p, "inst", "include", "cpp11", "declarations.hpp")))
17+
expect_true(dir.exists(file.path(p, "inst", "include", "cpp11")))
18+
expect_true(file.exists(file.path(p, "inst", "include", "cpp11.hpp")))
19+
expect_true(file.exists(file.path(p, "inst", "include", "cpp11", "declarations.hpp")))
2920

30-
expect_silent(cpp_unvendor(pkg_path(pkg)))
21+
expect_silent(cpp_unvendor(pkg_path(pkg)))
22+
})
3123
})

0 commit comments

Comments
 (0)