-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' into release_0.4.0
- Loading branch information
Showing
2 changed files
with
92 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
test_that("Find config when within a package with validation", { | ||
|
||
withr::with_tempdir({ | ||
quiet <- capture.output({ | ||
vt_create_package( | ||
"example.package", | ||
open = FALSE) | ||
}) | ||
|
||
|
||
withr::with_dir(new = "example.package", { | ||
expect_equal( | ||
vt_find_config(), | ||
normalizePath(file.path(getwd(), "vignettes","validation","validation.yml"),winslash = "/") | ||
) | ||
}) | ||
}) | ||
}) | ||
|
||
test_that("Find config when within a package with validation when working dir is non-standard", { | ||
|
||
withr::with_tempdir({ | ||
quiet <- capture.output({ | ||
vt_create_package( | ||
"example.package", | ||
working_dir = "inst", | ||
open = FALSE) | ||
}) | ||
|
||
|
||
withr::with_dir(new = "example.package", { | ||
expect_equal( | ||
vt_find_config(), | ||
normalizePath( | ||
file.path(getwd(), "inst","validation","validation.yml"), | ||
winslash = "/") | ||
) | ||
}) | ||
}) | ||
}) | ||
|
||
test_that("Find config when within a validation packet", { | ||
|
||
withr::with_tempdir({ | ||
quiet <- capture.output({ | ||
vt_create_packet("example_packet", | ||
target = "example.package", | ||
open = FALSE) | ||
}) | ||
|
||
|
||
withr::with_dir(new = "example_packet", { | ||
expect_equal( | ||
vt_find_config(), | ||
normalizePath( | ||
file.path(getwd(), "validation","validation.yml"), | ||
winslash = "/") | ||
) | ||
}) | ||
|
||
}) | ||
|
||
}) | ||
|
||
|
||
test_that("Informative error when outside a packet or package", { | ||
|
||
withr::with_tempdir({ | ||
|
||
expect_error( | ||
vt_find_config(), | ||
paste0( | ||
"Could not find root directory. ", | ||
"Is your working directory inside a package, validation packet, or project?\n" | ||
), | ||
fixed = TRUE) | ||
}) | ||
|
||
}) | ||
|