Debian Codegraph @

tests/testthat/test-link.R

raw
1 describe("link_path", {
2 with_dir_tree("foo", {
3 link_create(path_abs("foo"), "loo")
4 it("fails if given a non-link", {
5 expect_error(link_path("foo"), "Failed to read link", class = "fs_error")
6 })
7 it("returns the link path if given a link", {
8 expect_equal(link_path("loo"), path_abs("foo"))
9 })
10 it("fails silently if a link already exists and it points to the same location", {
11 expect_error_free(link_create(path_abs("foo"), "loo"))
12 })
13 it("fails if a link already exists and it does not point to the same location", {
14 dir_create("boo")
15 expect_error(link_create(path_abs("boo"), "loo"), class = "EEXIST")
16 })
17 })
18 it("errors on missing input", {
19 expect_error(link_path(NA), class = "invalid_argument")
20 })
21 })