Skip to content

Commit

Permalink
Add test for pmap()
Browse files Browse the repository at this point in the history
And NEWS bullet
  • Loading branch information
lionel- committed Aug 5, 2020
1 parent fe832e4 commit 332cc5d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
3 changes: 3 additions & 0 deletions NEWS.md
Expand Up @@ -11,6 +11,9 @@

## Features and fixes

* `map2()` and `pmap()` now recycle names of their first input if
needed (#783).

* `every()` and `some()` now properly check the return value of their
predicate function. It must now return a `TRUE`, `FALSE`, or `NA`.

Expand Down
6 changes: 5 additions & 1 deletion tests/testthat/test-map2.R
Expand Up @@ -60,9 +60,13 @@ test_that("map2() with empty input copies names", {
expect_identical(map2_raw(named_list, list(), identity), named(raw()))
})

test_that("map2() recycle names (#779)", {
test_that("map2() and pmap() recycle names (#779)", {
expect_identical(
map2(c(a = 1), 1:2, ~ .x),
list(a = 1, a = 1)
)
expect_identical(
pmap(list(c(a = 1), 1:2), ~ .x),
list(a = 1, a = 1)
)
})

0 comments on commit 332cc5d

Please sign in to comment.