tests/testthat/helper-groups.R

expect_groups <- function(df, groups, info = NULL) {
  if (length(groups) == 0L) {
    expect_null(groups(df), info = info)
    expect_identical(group_vars(df), character(), info = info)
  } else {
    expect_identical(groups(df), lapply(enc2native(groups), as.name), info = info)
    expect_identical(group_vars(df), groups, info = info)
  }
}

expect_no_groups <- function(df) {
  expect_groups(df, NULL)
}
olascodgreat/samife documentation built on May 13, 2019, 6:11 p.m.