-
Notifications
You must be signed in to change notification settings - Fork 76
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Documentation (in import() as well as not using serialization formats in the overview vignette) * Correct the deprecating warning * Add an undocumented option: rio.import.trust. We don't need to advertise this to encourage users to override this.
- Loading branch information
1 parent
4b99765
commit c86db70
Showing
9 changed files
with
106 additions
and
66 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
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
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
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,61 @@ | ||
test_that("Deprecation of untrusted dump", { | ||
withr::with_tempfile("iris_file", fileext = ".dump", code = { | ||
export(iris, iris_file) | ||
## expect deprecation to work | ||
lifecycle::expect_deprecated(import(iris_file), regexp = "set to FALSE by default") | ||
## expect false to error | ||
expect_error(import(iris_file, trust = FALSE)) | ||
}) | ||
}) | ||
|
||
test_that("Deprecation of untrusted Rdata", { | ||
withr::with_tempfile("iris_file", fileext = ".Rdata", code = { | ||
export(iris, iris_file) | ||
## expect deprecation to work | ||
lifecycle::expect_deprecated(import(iris_file), regexp = "set to FALSE by default") | ||
## expect false to error | ||
expect_error(import(iris_file, trust = FALSE)) | ||
}) | ||
}) | ||
|
||
test_that("Deprecation of untrusted rds", { | ||
withr::with_tempfile("iris_file", fileext = ".rds", code = { | ||
export(iris, iris_file) | ||
## expect deprecation to work | ||
lifecycle::expect_deprecated(import(iris_file), regexp = "set to FALSE by default") | ||
## expect false to error | ||
expect_error(import(iris_file, trust = FALSE)) | ||
}) | ||
}) | ||
|
||
test_that("No deprecation warning if `trust` is explicit", { | ||
withr::with_tempfile("iris_file", fileext = ".rds", code = { | ||
export(iris, iris_file) | ||
expect_silent(import(iris_file, trust = TRUE)) | ||
expect_error(import(iris_file, trust = FALSE)) ## no warning right? | ||
}) | ||
}) | ||
|
||
test_that("Undocumented feature, options", { | ||
withr::with_options(list(rio.import.trust = TRUE), { | ||
withr::with_tempfile("iris_file", fileext = ".rds", code = { | ||
export(iris, iris_file) | ||
expect_silent(import(iris_file)) | ||
expect_error(import(iris_file), NA) | ||
}) | ||
}) | ||
withr::with_options(list(rio.import.trust = FALSE), { | ||
withr::with_tempfile("iris_file", fileext = ".rds", code = { | ||
export(iris, iris_file) | ||
expect_error(import(iris_file)) | ||
}) | ||
}) | ||
}) | ||
|
||
test_that("`trust` wont cause problems for other import methods", { | ||
withr::with_tempfile("iris_file", fileext = ".xlsx", code = { | ||
export(iris, iris_file) | ||
expect_silent(import(iris_file, trust = TRUE)) | ||
expect_error(import(iris_file, trust = FALSE), NA) | ||
}) | ||
}) |
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