While developing an R package, I often have an R script handy to run some quick tests. (Later I'll either delete the file or formalize it into something in the tests
directory.) I'll edit some of the package source, rebuild the package (or just reload it with Load All), then source the script to see if whatever I was working on is working.
The problem with this workflow is that sometimes I accidentally source the package source instead of the test script. That has the bad side effect of putting copies of the functions from that file into the global workspace, where tests will look first, instead of looking in the package code. The cure is fairly simple (just wipe the workspace clean by running rm(list = ls())
), but it's still irritating, and can lead to confusing results from tests if I forget to do the delete.
So my questions are:
- Is there a way to disable the Source button for files that are part of the package under development?
- Alternatively, is there a simple way to specify that a particular test script should be run without switching to that tab?
- What do other people do to run some quick tests in the middle of developing code?