tests/testthat/test-s3-ggplot2-ggproto.R

test_that("ggproto", {
  expect_construct(
    ggplot2::ggproto(
      "Adder",
      add = function(self, n) {
        self$x <- self$x + n
        self$x
      },
      x = 0
    )
  )
})

Try the constructive package in your browser

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

constructive documentation built on Nov. 5, 2025, 7:14 p.m.