@@ -249,7 +249,11 @@ gc_mem = function() {
249249 # nocov end
250250}
251251
252- test = function (num ,x ,y = TRUE ,error = NULL ,warning = NULL ,message = NULL ,output = NULL ,notOutput = NULL ,ignore.warning = NULL ) {
252+ test = function (num ,x ,y = TRUE ,error = NULL ,warning = NULL ,message = NULL ,output = NULL ,notOutput = NULL ,ignore.warning = NULL ,options = NULL ) {
253+ if (! is.null(options )) {
254+ old_options <- do.call(' options' , as.list(options )) # as.list(): allow passing named character vector for convenience
255+ on.exit(options(old_options ), add = TRUE )
256+ }
253257 # Usage:
254258 # i) tests that x equals y when both x and y are supplied, the most common usage
255259 # ii) tests that x is TRUE when y isn't supplied
@@ -280,7 +284,7 @@ test = function(num,x,y=TRUE,error=NULL,warning=NULL,message=NULL,output=NULL,no
280284 foreign = get(" foreign" , parent.frame())
281285 showProgress = get(" showProgress" , parent.frame())
282286 time = nTest = RSS = NULL # to avoid 'no visible binding' note
283- if (num > 0 ) on.exit( {
287+ if (num > 0 ) on.exit( add = TRUE , {
284288 took = proc.time()[3L ]- lasttime # so that prep time between tests is attributed to the following test
285289 timings [as.integer(num ), `:=`(time = time + took , nTest = nTest + 1L ), verbose = FALSE ]
286290 if (memtest ) {
0 commit comments