-
Notifications
You must be signed in to change notification settings - Fork 90
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #489 from r2evans/feature/extlib_no_package
change with_extlib to work without packages
- Loading branch information
Showing
4 changed files
with
62 additions
and
8 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,24 @@ | ||
context("extlib without packages") | ||
|
||
test_that("with_extlib successfully works with no packages provided", { | ||
|
||
## Make sure packrat mode is off | ||
if (packrat:::isPackratModeOn()) | ||
packrat::off() | ||
|
||
orig_libs <- packrat:::getLibPaths() | ||
.libPaths(c(file.path(getwd(), "packages"), orig_libs)) | ||
on.exit(.libPaths(orig_libs), add = TRUE) | ||
|
||
expect_identical(packageVersion("bread"), package_version("1.0.0")) | ||
|
||
# don't use packrat::on so we can avoid the initialization step | ||
packrat:::setPackratModeOn(auto.snapshot = FALSE, clean.search.path = FALSE) | ||
|
||
expect_error(packageVersion("bread"), "package 'bread' not found") | ||
|
||
expect_identical(packrat::with_extlib(expr = packageVersion("bread")), package_version("1.0.0")) | ||
|
||
packrat::off() | ||
|
||
}) |