tests/testthat/test-printing.R

context("printing")

test_that("can override printing with proto_print", {
  x <- proto(proto_print = function(.) 10)
  out <- capture.output(print(x))[[1]]
  expect_match(out, "10")
})

test_that("default object prints as environment", {
  x <- proto()
  out <- capture.output(print(x))[[1]]
  expect_match(out, "environment")
})

Try the proto package in your browser

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

proto documentation built on May 2, 2019, 1:08 p.m.