@@ -130,6 +130,7 @@ test.data.table = function(script="tests.Rraw", verbose=FALSE, pkg=".", silent=F
130130 }
131131 assign(" foreign" , foreign , envir = env )
132132 assign(" nfail" , 0L , envir = env )
133+ assign(" nskip" , 0L , envir = env )
133134 assign(" ntest" , 0L , envir = env )
134135 assign(" prevtest" , - 1L , envir = env )
135136 assign(" whichfail" , NULL , envir = env )
@@ -282,6 +283,7 @@ test.data.table = function(script="tests.Rraw", verbose=FALSE, pkg=".", silent=F
282283
283284 nfail = env $ nfail
284285 ntest = env $ ntest
286+ nskip = env $ nskip
285287 if (nfail > 0L ) {
286288 # nocov start
287289 stopf(
@@ -331,6 +333,7 @@ test.data.table = function(script="tests.Rraw", verbose=FALSE, pkg=".", silent=F
331333 get(" mtext" )(lastRSS , side = 4L , at = lastRSS , las = 1L , font = 2L )
332334 }
333335
336+ if (foreign && nskip > 0L ) catf(" Skipped %d tests for translated messages. " , nskip ) # nocov
334337 catf(" All %d tests (last %.8g) in %s completed ok in %s\n " , ntest , env $ prevtest , names(fn ), timetaken(env $ started.at ))
335338 ans = nfail == 0L
336339 attr(ans , " timings" ) = timings # as attr to not upset callers who expect a TRUE/FALSE result
@@ -409,6 +412,7 @@ test = function(num,x,y=TRUE,error=NULL,warning=NULL,message=NULL,output=NULL,no
409412 memtest.id = get(" memtest.id" , parent.frame())
410413 filename = get(" filename" , parent.frame())
411414 foreign = get(" foreign" , parent.frame())
415+ nskip = get(" nskip" , parent.frame())
412416 showProgress = get(" showProgress" , parent.frame())
413417 time = nTest = RSS = NULL # to avoid 'no visible binding' note
414418 # TODO(R>=4.0.2): Use add=TRUE up-front in on.exit() once non-positional arguments are supported.
@@ -451,6 +455,11 @@ test = function(num,x,y=TRUE,error=NULL,warning=NULL,message=NULL,output=NULL,no
451455 length(grep(x , y , fixed = TRUE )) || # try treating x as literal first; useful for most messages containing ()[]+ characters
452456 length(tryCatch(grep(x , y , ignore.case = ignore.case ), error = function (e )NULL )) # otherwise try x as regexp
453457 }
458+ if (foreign && .test.data.table && (
459+ length(error ) || length(warning ) || length(message ) || length(output ) ||
460+ length(notOutput ) || length(ignore.warning )
461+ ))
462+ assign(" nskip" , nskip + 1L , parent.frame(), inherits = TRUE ) # nocov
454463
455464 xsub = substitute(x )
456465 ysub = substitute(y )
0 commit comments