tests/testthat/test-cols_hide.R

test_that("The `cols_hide()` and `cols_hide()` do not error when no columns selected", {
  # when no columns selected, gt table return unaltered
  expect_equal(
    gt(sp500),
    gt(sp500) %>% cols_hide(columns = starts_with("xxxxxxxxxxxx"))
  )

  expect_equal(
    gt(sp500),
    gt(sp500) %>% cols_unhide(columns = starts_with("xxxxxxxxxxxx"))
  )
})

Try the gt package in your browser

Any scripts or data that you put into this service are public.

gt documentation built on June 22, 2024, 11:11 a.m.