Skip to content

Commit bae7efc

Browse files
committed
Update test
1 parent c7d8f84 commit bae7efc

File tree

1 file changed

+21
-13
lines changed

1 file changed

+21
-13
lines changed

tests/testthat/test-utils-projects.R

Lines changed: 21 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -16,20 +16,28 @@ test_that("project_path() uses Quarto environment variables", {
1616
temp_dir <- withr::local_tempdir()
1717
withr::local_dir(temp_dir)
1818
dir.create("project")
19-
withr::local_envvar(
20-
QUARTO_PROJECT_ROOT = xfun::normalize_path(file.path(temp_dir, "project"))
21-
)
22-
expect_identical(
23-
project_path("data", "file.csv"),
24-
file.path("project", "data", "file.csv")
25-
)
26-
withr::local_envvar(
27-
QUARTO_PROJECT_ROOT = "",
28-
QUARTO_PROJECT_DIR = xfun::normalize_path(file.path(temp_dir, "project"))
19+
withr::with_envvar(
20+
list(
21+
QUARTO_PROJECT_ROOT = xfun::normalize_path(file.path(
22+
temp_dir,
23+
"project"
24+
)),
25+
QUARTO_PROJECT_DIR = ""
26+
),
27+
expect_identical(
28+
project_path("data", "file.csv"),
29+
file.path("project", "data", "file.csv")
30+
)
2931
)
30-
expect_identical(
31-
project_path("data", "file.csv"),
32-
file.path("project", "data", "file.csv")
32+
withr::with_envvar(
33+
list(
34+
QUARTO_PROJECT_ROOT = "",
35+
QUARTO_PROJECT_DIR = xfun::normalize_path(file.path(temp_dir, "project"))
36+
),
37+
expect_identical(
38+
project_path("data", "file.csv"),
39+
file.path("project", "data", "file.csv")
40+
)
3341
)
3442
})
3543

0 commit comments

Comments
 (0)