Skip to content

Commit

Permalink
Add test for tidyverse#6304
Browse files Browse the repository at this point in the history
  • Loading branch information
DavisVaughan committed Jun 28, 2022
1 parent 8b58504 commit 70b2225
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions tests/testthat/test-context.R
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,17 @@ test_that("cur_group() works", {

})

test_that("cur_group() works with empty grouped data frame (#6304)", {
df <- tibble(x = integer())
gdf <- group_by(df, x)

out <- mutate(df, y = cur_group())
expect_identical(out$y, tibble())

out <- mutate(gdf, y = cur_group())
expect_identical(out$y, tibble(x = integer()))
})

test_that("cur_group_idx() gives unique id", {
df <- tibble(x = c("b", "a", "b"))
gf <- group_by(df, x)
Expand Down

0 comments on commit 70b2225

Please sign in to comment.