Debian Codegraph @

tests/testthat/test-path_package.R

raw
1 describe("path_package", {
2 it("errors if the package does not exist", {
3 cnd <- tryCatch(path_package("arst"), error = function(e) e)
4 expect_s3_class(cnd, "EEXIST")
5 expect_match(conditionMessage(cnd), "Can't find package")
6 })
7 it("errors if the package location is not found", {
8 cnd <- tryCatch(path_package("base", "foo"), error = function(e) e)
9 expect_s3_class(cnd, "EEXIST")
10 expect_match(conditionMessage(cnd), "do(es)? not exist")
11 })
12 it("works on installed files", {
13 expect_error_free(p <- path_package("base", "INDEX"))
14 expect_s3_class(p, "fs_path")
15 })
16 })