tests/testthat/test-sticky_tbl_df.R

test_that("new_sticky_tibble", {
  x <- list(col_1 = letters, col_2 = letters)

  # cols
  expect_output(
    new_sticky_tibble(x, cols = col_1) |>
      print(),
    "# Stickers: col_1"
  )

  expect_error(
    new_sticky_tibble(x, cols = col_3)
  )

  # col_summary
  expect_output(
    new_sticky_tibble(x, cols = col_1, col_summary = list(col_1 = vec_init)) |>
      print(),
    "# Stickers: col_1"
  )

  expect_error(
    new_sticky_tibble(x, cols = col_1, col_summary = list(col_3 = vec_init))
  )

  # col_show
  expect_output(
    new_sticky_tibble(x, cols = col_1, col_show = col_1) |>
      print(),
    "# Stickers: col_1"
  )

  x_col_show <- new_sticky_tibble(x, cols = c(col_1, col_2), col_show = col_1)
  expect_match(
    format(x_col_show),
    "col_1",
    all = FALSE
  )
  expect_no_match(
    format(x_col_show),
    "col_2"
  )
  expect_error(
    new_sticky_tibble(x, cols = col_1, col_show = col_3)
  )
})

Try the stickyr package in your browser

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

stickyr documentation built on July 13, 2026, 1:06 a.m.