tests/testthat/test-create_s3_methods.R

context("create_s3_methods")

a <- structure(1:10, class = c("b", "numeric"))
d <- structure(10, class = c("b", "numeric"))
`[.b` <- create_s3_method("[")
max.b <- create_s3_method("max")
print.b <- create_s3_print(as.numeric)

test_that("create_s3_methods", {
  expect_is(a[1], "b")  
  expect_equivalent(max(a), d)
})


test_that("create_s3_print", {
  expect_is(create_s3_print(as.numeric), "function")
  expect_output(print(a))
})

Try the incadata package in your browser

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

incadata documentation built on April 14, 2020, 6:08 p.m.