Closed DavisVaughan closed 5 years ago
Hey @DavisVaughan thanks a lot for this. I am really glad we don't need to expose test functions. This is much better.
I have left a comment regarding the files generated by Rcpp which I think can be added to .gitignore
since they are generated with the configure
script.
Should be good to go now
Thanks!
This PR improves the test suite of xtensor to use testthat in a more standard fashion. Specifically, a few of the changes are:
tests/testthat/<testfile.R>
.src/
. They are not exported when the user callslibrary(xtensor)
. i.e. the user will not see them withxtensor::
, only withxtensor:::
. This should be pretty nonintrusive.test/
folder has been removed.test/
. Now tests are automatically run whenR CMD check
is called. https://travis-ci.org/DavisVaughan/Xtensor.R/jobs/473077087#L1690A bit more on the new test structure. I talked with some of my RStudio folks on the best way to have cpp files that only get run during tests, and then called from the R test files. I was encouraged to just place them in
src/
and use theRcpp::export
attribute which makes them callable from R for the tests, but not to the general R user who uses the package. At first I tried placing the cpp files intests/testthat/<test.cpp>
and that worked withdevtools::check()
but notdevtools::test()
because of some include path problems. All in all, placing them insrc/
might seem annoying at the surface level, but I'm convinced it is ultimately the most stable way to do this.I also added the header folders to the gitignore because they kept popping up in RStudio as suggestions to commit. Hopefully that's fine.