Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Wes Hinsley <[email protected]>
  • Loading branch information
richfitz and weshinsley authored Nov 6, 2024
1 parent 1411e12 commit e115d56
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
2 changes: 1 addition & 1 deletion R/packer-grouped.R
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
##' are shared among all groups.
##'
##' @param process An arbitrary R function that will be passed the
##' final assembled list **for each region**; it may create any
##' final assembled list **for each group**; it may create any
##' *additional* entries, which will be concatenated onto the
##' original list. If you use this you should take care not to
##' return any values with the same names as entries listed in
Expand Down
14 changes: 12 additions & 2 deletions tests/testthat/test-packer-grouped.R
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,17 @@ test_that("Can print a grouped packer", {
})


test_that("can used process with grouped packer", {
test_that("process can't duplicate existing var with grouped packer", {
process <- function(res) {
list(x = res$x + res$y)
}
expect_error(
monty_packer_grouped(c("a", "b"), c("x", "y"), process = process),
"'process\\(\\)' is trying to overwrite")
})


test_that("can use process with grouped packer", {
process <- function(res) {
list(z = res$x + res$y)
}
Expand All @@ -243,7 +253,7 @@ test_that("can used process with grouped packer", {
})


test_that("can used process with grouped packer", {
test_that("can use process with grouped packer", {
expect_error(
monty_packer_grouped(c("a", "b"), c("x", "y"), process = TRUE),
"Expected a function for 'process'")
Expand Down

0 comments on commit e115d56

Please sign in to comment.