tests/testthat/test-type_sum.R

test_that("works with glimpse", {
  local_override_type_sum()

  foo <- as_override_type_sum_asis(2011:2013)
  bar <- as_override_type_sum_custom(2011:2013)
  expect_equal(unclass(type_sum(foo)), "AsIs")
  expect_equal(unclass(type_sum(bar)), "VeryLong")

  expect_snapshot({
    glimpse(new_tbl(list(foo = foo, bar = bar)))
  })
})

test_that("can override", {
  local_override_type_sum()

  foo <- as_override_type_sum_asis(2011:2013)
  bar <- as_override_type_sum_custom(2011:2013)

  expect_snapshot({
    new_tbl(list(foo = foo, bar = bar))
    options(width = 13)
    new_tbl(list(foo = foo, bar = bar))
  })
})
hadley/pillar documentation built on April 26, 2024, 4:19 a.m.