[Rcpp-commits] r1031 - pkg/Rcpp/inst/unitTests

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Mon Apr 12 11:02:14 CEST 2010


Author: romain
Date: 2010-04-12 11:02:14 +0200 (Mon, 12 Apr 2010)
New Revision: 1031

Modified:
   pkg/Rcpp/inst/unitTests/runTests.R
Log:
also count errors (not just failures)

Modified: pkg/Rcpp/inst/unitTests/runTests.R
===================================================================
--- pkg/Rcpp/inst/unitTests/runTests.R	2010-04-10 10:13:44 UTC (rev 1030)
+++ pkg/Rcpp/inst/unitTests/runTests.R	2010-04-12 09:02:14 UTC (rev 1031)
@@ -16,7 +16,7 @@
     ## --- Testing ---
 
     ## Define tests
-    testSuite <- defineTestSuite(name=paste(pkg, "unit testing"), dirs = path)
+    testSuite <- defineTestSuite(name=paste(pkg, "unit testing"), dirs = path, testFileRegexp = "^runit[.]as" )
 
     if(interactive()) {
         cat("Now have RUnit Test Suite 'testSuite' for package '", pkg,
@@ -77,8 +77,12 @@
 
         ##  stop() if there are any failures i.e. FALSE to unit test.
         ## This will cause R CMD check to return error and stop
-        if(getErrors(tests)$nFail > 0) {
-            stop("one of the unit tests failed")
+        err <- getErrors(tests)
+        if( (err$nFail + err$nErr) > 0) {
+            stop( sprintf( "unit test problems: %d failures, %d errors", err$nFail, err$nErr) )
+        } else{
+        	success <- err$nTestFunc - err$nFail - err$nErr - err$nDeactivated
+        	cat( sprintf( "%d / %d", success, err$nTestFunc ) )
         }
     }
 } else {



More information about the Rcpp-commits mailing list