tests/Interface.R

library("R.oo")

message("TESTING: Interface...")

int <- Interface()
print(int)

setConstructorS3("MyInterface", function(...) {
  extend(Interface(), "MyInterface")
})
int <- MyInterface()
print(int)

setConstructorS3("MyClass", function(...) {
  extend(Object(), c("MyClass", uses(MyInterface(), Interface())))
})
obj <- MyClass()
print(obj)


## For some reason uses(<string>) doesn't play well with covr
if (!"covr" %in% loadedNamespaces()) {
  setConstructorS3("MyClass", function(...) {
    extend(Object(), c("MyClass", uses("MyInterface", "Interface")))
  })
  obj <- MyClass()
  print(obj)
}

message("TESTING: Interface...DONE")

Try the R.oo package in your browser

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

R.oo documentation built on June 12, 2022, 9:05 a.m.