tests/testthat/helper-type-sum.R

as_override_type_sum_asis <- function(x) {
  structure(x, class = "override_type_sum_asis")
}

as_override_type_sum_custom <- function(x) {
  structure(x, class = "override_type_sum_custom")
}

local_override_type_sum <- function(frame = caller_env()) {
  local_methods(
    .frame = frame,
    type_sum.override_type_sum_asis = function(x, ...) {
      I("AsIs")
    },
    # Needed for head()
    `[.override_type_sum_asis` = function(x, ...) {
      as_override_type_sum_asis(NextMethod())
    },
    type_sum.override_type_sum_custom = function(x, ...) {
      structure("VeryLong", class = "override_format_type_sum")
    },
    # Needed for head()
    `[.override_type_sum_custom` = function(x, ...) {
      as_override_type_sum_custom(NextMethod())
    },
    format_type_sum.override_format_type_sum = function(x, ...) {
      "VeryLong"
    }
  )
}

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.