-
Notifications
You must be signed in to change notification settings - Fork 336
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Break up into smaller functions and add some tests
- Loading branch information
Showing
3 changed files
with
65 additions
and
27 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,17 @@ | ||
# check integrity validates integrity | ||
|
||
Code | ||
check_integrity(temp, "sha123-abc") | ||
Condition | ||
Error in `check_integrity()`: | ||
! integrity must use SHA-256, SHA-384, or SHA-512 | ||
i This is an internal error that was detected in the pkgdown package. | ||
Please report it at <https://github.com/r-lib/pkgdown/issues> with a reprex (<https://tidyverse.org/help/>) and the full backtrace. | ||
Code | ||
check_integrity(temp, "sha256-abc") | ||
Condition | ||
Error in `check_integrity()`: | ||
! Downloaded asset does not match known integrity | ||
i This is an internal error that was detected in the pkgdown package. | ||
Please report it at <https://github.com/r-lib/pkgdown/issues> with a reprex (<https://tidyverse.org/help/>) and the full backtrace. | ||
|
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,15 @@ | ||
test_that("check integrity validates integrity", { | ||
temp <- withr::local_tempfile(lines = letters) | ||
|
||
expect_snapshot(error = TRUE, { | ||
check_integrity(temp, "sha123-abc") | ||
check_integrity(temp, "sha256-abc") | ||
}) | ||
|
||
integrity <- paste0("sha256-", compute_hash(temp, 256L)) | ||
expect_no_error(check_integrity(temp, integrity)) | ||
}) | ||
|
||
test_that("can parse integrity", { | ||
expect_equal(parse_integrity("sha256-abc"), list(size = 256L, hash = "abc")) | ||
}) |