[inlinedocs] new unit tests
Toby Dylan Hocking
Toby.Hocking at inria.fr
Mon Jun 7 15:20:24 CEST 2010
The old unit testing system was not very accurate, so I have retired
it. In particular, small changes to the Rd files that had no effect in
the actual docs were appearing as significant differences in the
testing framework.
Today I worked out a new system for unit testing part of the
inlinedocs package. The new system I have devised should be more
robust. It just tests the documentation lists that result after
parsing the .R source files. And furthermore, the order of items in
the documentation lists should not matter.
The new unit test framework currently works only for the parsing part
of the package (not the Rd writing part). The idea is:
1. make a inlinedocs/inst/testfiles/code.R source file with some
inlinedocs.
2. somewhere in that file, define the variable .result as the
documentation list that should result after processing that file with
extract.docs.file.
3. when we make changes to the inlinedocs package, we can run R CMD
check, and this will automatically run test.file() on each of
inst/testfiles/*.R
4. if any of the items defined in .result are not present in the
actual results obtained by processing the file with
extract.docs.file(), we stop() with an error!
Comments are welcome! Also, does anyone have any ideas about how to
test the other side of the package? That is, given a documentation
list, how do we make sure that we generate accurate Rd files? I tried
looking into the tools package and parse_Rd(), but I didn't find
anything that would allow robust comparison of generated Rd files with
references.
More information about the Inlinedocs-support
mailing list