Hello,

I have a function that applies to an S4 object which contains a slot called 
@analysis:

function calculation(myObject) {
  tmp <- myObjects@analysis
  result <- ...operations on analysis...
  return result
}

I am writing a unit test for this function.  So I was hoping to create a mock 
object but I can't figure out how to do it:

test_that("test calculation function", {
  mockMyObject<- mock(?????)  #I am not sure what to put here
  r<-calculation(mockMyObject)
  expect_true(r,0.83625)
})

How can I create a mock S4 object??

Thanks in advance,
Ramiro

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to