tests/testthat/test-format_numeric.R

test_that("same pillar at different widths", {
  v <- 10^c(-5, -2, 3, 6)
  x <- pillar(v)
  expect_equal(get_min_width(x$data), 4)
  expect_equal(get_width(x$data), 13)
  expect_snapshot({
    pillar(v, width = 4)
    pillar(v, width = 7)
    pillar(v, width = 10)
    pillar(v, width = 15)
    pillar(v, width = 22)
  })
})

Try the pillar package in your browser

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

pillar documentation built on March 31, 2023, 10:19 p.m.