r - data.table and testthat package

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-01 03:53:27

To long for comment so posting as answer.

  1. Don't use underscore in package name, it breaks the standard. Underscores will be turned to dots.

  2. Can't really tell you why testthat failed to process your test. You can try to export test function. It is not exported so should be used only with ::: explicitly. Maybe testthat depends on that in some way, don't know.

  3. Test is passing when I move tests out of testthat. If you fail to resolve it I would look for support in testthat issues.

You can see my fork jangorecki/test_datatable_testthat of your pkg (url won't work in few days from now so fetch the changes if you want to access them later).
Your test moved out of testthat is in tests/test.R, content below.

dt <- test.datatable.testthat:::test()
expected_res <- structure(list(TYPE = c("ERROR", "ERROR"),
                               MESSAGE = c("Test","1234567890")),
                          row.names = c(NA, -2L), class = c("data.table","data.frame"),
                          .Names = c("TYPE", "MESSAGE"))
stopifnot(all.equal(dt,expected_res))

Testthat test is suppressed by changing it to dummy, kind of TRUE==TRUE. Now your test defined outside of testthat pass OK.
Related part from 00check.log:

* checking tests ...
  Running ‘test.R’
  Running ‘testthat.R’
 OK
* DONE
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!